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
6a8d49c1
Commit
6a8d49c1
authored
Jun 19, 2020
by
Marcel Nellesen
Browse files
Merge branch 'Sprint/2020-10' into 'master'
Sprint/2020-10 See merge request coscine/cs/migrations!17
parents
d173cedf
f1095746
Changes
7
Pipelines
5
Hide whitespace changes
Inline
Side-by-side
src/Migrator/Migrations/Migration202005151300ExtendUser.cs
0 → 100644
View file @
6a8d49c1
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/Migrations/Migration202005251520TOS.cs
0 → 100644
View file @
6a8d49c1
using
FluentMigrator
;
using
System
;
namespace
Coscine.Database.Migration.Migrations
{
//yyyymmddhhmm
[
Migration
(
202005251520
)]
public
class
Migration202005251520TOS
:
FluentMigrator
.
Migration
{
public
override
void
Down
()
{
Delete
.
Table
(
"TOSAccepted"
);
}
public
override
void
Up
()
{
Create
.
Table
(
"TOSAccepted"
)
.
WithColumn
(
"RelationId"
).
AsGuid
().
PrimaryKey
().
WithDefault
(
SystemMethods
.
NewGuid
)
.
WithColumn
(
"UserId"
).
AsGuid
().
NotNullable
()
.
WithColumn
(
"Version"
).
AsString
(
10
).
NotNullable
();
Create
.
ForeignKey
()
.
FromTable
(
"TOSAccepted"
).
ForeignColumn
(
"UserId"
)
.
ToTable
(
"Users"
).
PrimaryColumn
(
"Id"
);
}
}
}
src/Migrator/Migrations/Migration202005281400ProjectUrl.cs
0 → 100644
View file @
6a8d49c1
using
FluentMigrator
;
using
System
;
namespace
Coscine.Database.Migration.Migrations
{
//yyyymmddhhmm
[
Migration
(
202005281400
)]
public
class
Migration202005281400ProjectUrl
:
FluentMigrator
.
Migration
{
public
override
void
Down
()
{
Delete
.
Column
(
"Slug"
).
FromTable
(
"Projects"
);
}
public
override
void
Up
()
{
Alter
.
Table
(
"Projects"
).
AddColumn
(
"Slug"
).
AsString
(
63
).
Nullable
();
Execute
.
EmbeddedScript
(
"Migration202005281400ProjectUrl_up.sql"
);
Alter
.
Table
(
"Projects"
).
AlterColumn
(
"Slug"
).
AsString
(
63
).
NotNullable
();
}
}
}
src/Migrator/Migrations/Migration202005281400ProjectUrl_up.sql
0 → 100644
View file @
6a8d49c1
UPDATE
[
Coscine
].[
dbo
].[
Projects
]
SET
Slug
=
Id
\ No newline at end of file
src/Migrator/Migrator.csproj
View file @
6a8d49c1
...
...
@@ -146,6 +146,7 @@
<Compile
Include=
"MigrationsHelpers.cs"
/>
<Compile
Include=
"Migrations\Migration201907011352ProjectApi.cs"
/>
<Compile
Include=
"Migrations\Migration201907081510EnhanceProjectApi.cs"
/>
<Compile
Include=
"Migrations\Migration202005281400ProjectUrl.cs"
/>
<Compile
Include=
"Migrations\Migration201910021300ResourceDescription.cs"
/>
<Compile
Include=
"Migrations\Migration201909190938ResourceEnhancement.cs"
/>
<Compile
Include=
"Migrations\Migration201909111125ProjectEnhancement.cs"
/>
...
...
@@ -168,8 +169,10 @@
<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=
"Migrations\Migration202005251520TOS.cs"
/>
<Compile
Include=
"Migrator.cs"
/>
<Compile
Include=
"Program.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
...
...
@@ -181,6 +184,9 @@
<EmbeddedResource
Include=
"Assets\Institutes.csv"
/>
<None
Include=
"packages.config"
/>
</ItemGroup>
<ItemGroup>
<EmbeddedResource
Include=
"Migrations\Migration202005281400ProjectUrl_up.sql"
/>
</ItemGroup>
<ItemGroup>
<EmbeddedResource
Include=
"Migrations\Migration202003121255ActivatedFeatures_up.sql"
/>
</ItemGroup>
...
...
src/Migrator/Program.cs
View file @
6a8d49c1
...
...
@@ -55,7 +55,6 @@ namespace Coscine.Database.Migration
}
else
{
Console
.
WriteLine
(
"Argument missing or invalid. Please enter the number of steps to roll back!"
);
}
...
...
src/Migrator/Properties/AssemblyInfo.cs
View file @
6a8d49c1
...
...
@@ -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