Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Coscine
backend
libraries
Migrations
Commits
61d5f8ff
Commit
61d5f8ff
authored
Jun 18, 2020
by
Marcel Nellesen
Committed by
Benedikt Heinrichs
Jun 18, 2020
Browse files
New: Included Functionality for the UserProfile Api
parent
d173cedf
Changes
3
Show whitespace changes
Inline
Side-by-side
src/Migrator/Migrations/Migration202005151300ExtendUser.cs
0 → 100644
View file @
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
}
}
}
src/Migrator/Migrator.csproj
View file @
61d5f8ff
...
...
@@ -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"
/>
...
...
src/Migrator/Properties/AssemblyInfo.cs
View file @
61d5f8ff
...
...
@@ -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"
)]
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment