Commit 6e51230b authored by Benedikt Heinrichs's avatar Benedikt Heinrichs
Browse files

Merge branch 'Topic/758-userProfileApi' into 'Product/702-createUserProfile'

New: Included Functionality for the UserProfile Api

See merge request coscine/cs/migrations!14
parents d173cedf 61d5f8ff
using FluentMigrator;
namespace Coscine.Database.Migration.Migrations
{
//yyyymmddhhmm
[Migration(202005151300)]
public class Migration202005151300ExtendUser : FluentMigrator.Migration
{
public override void Down()
{
#region Foreign Keys
Delete.ForeignKey()
.FromTable("Users").ForeignColumn("TitleId")
.ToTable("Titles").PrimaryColumn("Id");
Delete.ForeignKey()
.FromTable("Users").ForeignColumn("LanguageId")
.ToTable("Languages").PrimaryColumn("Id");
Delete.ForeignKey()
.FromTable("UserDisciplines").ForeignColumn("DisciplineId")
.ToTable("Disciplines").PrimaryColumn("Id");
Delete.ForeignKey()
.FromTable("UserDisciplines").ForeignColumn("UserId")
.ToTable("Users").PrimaryColumn("Id");
#endregion
Delete.Column("TitleId").FromTable("Users");
Delete.Column("LanguageId").FromTable("Users");
Delete.Column("Institute").FromTable("Users");
Delete.Table("Titles");
Delete.Table("Languages");
Delete.Table("UserDisciplines");
}
public override void Up()
{
Create.Table("Titles")
.WithColumn("Id").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid)
.WithColumn("DisplayName").AsString(50).NotNullable();
Insert.IntoTable("Titles").Row(new { DisplayName = "Prof." });
Insert.IntoTable("Titles").Row(new { DisplayName = "Dr." });
Create.Table("Languages")
.WithColumn("Id").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid)
.WithColumn("DisplayName").AsString(50).NotNullable()
.WithColumn("Abbreviation").AsString(50).NotNullable();
Insert.IntoTable("Languages").Row(new { DisplayName = "English", Abbreviation = "en" });
Insert.IntoTable("Languages").Row(new { DisplayName = "Deutsch", Abbreviation = "de" });
Create.Table("UserDisciplines")
.WithColumn("RelationId").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid)
.WithColumn("DisciplineId").AsGuid().NotNullable()
.WithColumn("UserId").AsGuid().NotNullable();
Alter.Table("Users").AddColumn("TitleId").AsGuid().Nullable();
Alter.Table("Users").AddColumn("LanguageId").AsGuid().Nullable();
Alter.Table("Users").AddColumn("Institute").AsString(200).Nullable();
#region Foreign Keys
Create.ForeignKey()
.FromTable("Users").ForeignColumn("TitleId")
.ToTable("Titles").PrimaryColumn("Id");
Create.ForeignKey()
.FromTable("Users").ForeignColumn("LanguageId")
.ToTable("Languages").PrimaryColumn("Id");
Create.ForeignKey()
.FromTable("UserDisciplines").ForeignColumn("DisciplineId")
.ToTable("Disciplines").PrimaryColumn("Id");
Create.ForeignKey()
.FromTable("UserDisciplines").ForeignColumn("UserId")
.ToTable("Users").PrimaryColumn("Id");
#endregion
}
}
}
......@@ -168,6 +168,7 @@
<Compile Include="Migrations\Migration202002101300MoreLicenses.cs" />
<Compile Include="Migrations\Migration202003231800Organizations.cs" />
<Compile Include="Migrations\Migration202003121255ActivatedFeatures.cs" />
<Compile Include="Migrations\Migration202005151300ExtendUser.cs" />
<Compile Include="Migrations\Migration202004151354S3ResourceUrl.cs" />
<Compile Include="Migrations\Migration202003192117ORCiDEmailAddress.cs" />
<Compile Include="Migrator.cs" />
......
......@@ -9,8 +9,8 @@ using System.Reflection;
[assembly: AssemblyDescription("Migrator is a part of the CoScInE group.")]
[assembly: AssemblyCompany("IT Center, RWTH Aachen University")]
[assembly: AssemblyProduct("Migrator")]
[assembly: AssemblyVersion("1.1.0")]
[assembly: AssemblyFileVersion("1.1.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: AssemblyVersion("1.4.0")]
[assembly: AssemblyFileVersion("1.4.0")]
[assembly: AssemblyInformationalVersion("1.4.0-topic-758-userpr0001")]
[assembly: AssemblyCopyright("2020 IT Center, RWTH Aachen University")]
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment