Commit 3952952e authored by Marcel Nellesen's avatar Marcel Nellesen
Browse files

Merge branch 'Sprint/2020-03' into 'master'

Sprint/2020-03

See merge request coscine/cs/migrations!2
parents fd793fb5 b87f71cc
stages:
- test
- docs
- release
- releasetrigger
......@@ -19,19 +18,11 @@ cake:Test:
- master
- tags
docs:
stage: docs
script:
- .\publishDocs.ps1 $GITLAB_TOKEN
variables:
GIT_STRATEGY: clone
only:
- tags
cake:Release:
stage: release
script:
- PowerShell .\build.ps1 -Target Release -Configuration Release --nugetApiKey="${NUGET_API_KEY}"
- PowerShell .\src\Migrator\bin\Release\Migrator.exe --migrate_up
variables:
GIT_STRATEGY: clone
dependencies:
......
{
"plugins": [
["@semantic-release/commit-analyzer", {
"preset": "eslint"
}],
["@semantic-release/release-notes-generator", {
"preset": "eslint",
}],
["@semantic-release/gitlab", {
"preset": "eslint",
"gitlabUrl": "https://git.rwth-aachen.de"
}],
["@semantic-release/exec", {
"prepareCmd" : "echo ${nextRelease.version}",
"publishCmd" : "echo test"
}],
["@semantic-release/git", {
"preset": "eslint",
"assets": "src/**/Properties/AssemblyInfo.cs",
"message": "Chore: ${nextRelease.version}\n\n${nextRelease.notes}"
}]
]
}
param(
$token
)
$remoteUrl = git config --get remote.origin.url
$remoteUrl = $remoteUrl.replace("git@", "")
$remoteUrl = $remoteUrl -replace "https(.*?)@",""
$remoteUrl = $remoteUrl.replace(":", "/")
$remoteUrl = $remoteUrl.replace(".git", ".wiki.git")
$temporaryFolderName = "publishDocsTempFolder"
git clone "https://gitlab-ci-token:$($token)@$($remoteUrl)" $temporaryFolderName
cd $temporaryFolderName
Remove-Item *
cp -r ../docs/* ./
git add .
git commit -m "Docs: Documentation Update"
git push
\ No newline at end of file

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28803.156
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Migrator", "Migrator\Migrator.csproj", "{A48A255E-D08A-4336-B481-266DEBFABDE9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A48A255E-D08A-4336-B481-266DEBFABDE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A48A255E-D08A-4336-B481-266DEBFABDE9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A48A255E-D08A-4336-B481-266DEBFABDE9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A48A255E-D08A-4336-B481-266DEBFABDE9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2B54411D-F046-46C3-940F-45B5BBD051CF}
EndGlobalSection
EndGlobal
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>
\ No newline at end of file
This diff is collapsed.
<?xml version="1.0" encoding="utf-8" ?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
<rdf:Description rdf:about="https://spdx.org/licenses/Apache-2.0">
<rdf:about>https://spdx.org/licenses/Apache-2.0</rdf:about>
<rdfs:label xml:lang="en">Apache License 2.0</rdfs:label>
<rdf:resource>http://purl.org/dc/terms/LicenseDocument</rdf:resource>
<rdf:resource>http://purl.org/dc/terms/RightsDocument</rdf:resource>
<rdf:type rdf:resource="https://spdx.org/licenses/"/>
</rdf:Description>
<rdf:Description rdf:about="https://spdx.org/licenses/GPL-3.0+">
<rdf:about>https://spdx.org/licenses/GPL-3.0+</rdf:about>
<rdfs:label xml:lang="en">GNU General Public License v3.0</rdfs:label>
<rdf:resource>http://purl.org/dc/terms/LicenseDocument</rdf:resource>
<rdf:resource>http://purl.org/dc/terms/RightsDocument</rdf:resource>
<rdf:type rdf:resource="https://spdx.org/licenses/"/>
</rdf:Description>
<rdf:Description rdf:about="https://spdx.org/licenses/MIT">
<rdf:about>https://spdx.org/licenses/MIT</rdf:about>
<rdfs:label xml:lang="en">MIT License</rdfs:label>
<rdf:resource>http://purl.org/dc/terms/LicenseDocument</rdf:resource>
<rdf:resource>http://purl.org/dc/terms/RightsDocument</rdf:resource>
<rdf:type rdf:resource="https://spdx.org/licenses/"/>
</rdf:Description>
<rdf:Description rdf:about="https://spdx.org/licenses/BSD-2-Clause">
<rdf:about>https://spdx.org/licenses/BSD-2-Clause</rdf:about>
<rdfs:label xml:lang="en">BSD 2-clause 'Simplified' License</rdfs:label>
<rdf:resource>http://purl.org/dc/terms/LicenseDocument</rdf:resource>
<rdf:resource>http://purl.org/dc/terms/RightsDocument</rdf:resource>
<rdf:type rdf:resource="https://spdx.org/licenses/"/>
</rdf:Description>
<rdf:Description rdf:about="https://spdx.org/licenses/BSD-3-Clause">
<rdf:about>https://spdx.org/licenses/BSD-3-Clause</rdf:about>
<rdfs:label xml:lang="en">BSD 3-clause 'New' or 'Revised' License</rdfs:label>
<rdf:resource>http://purl.org/dc/terms/LicenseDocument</rdf:resource>
<rdf:resource>http://purl.org/dc/terms/RightsDocument</rdf:resource>
<rdf:type rdf:resource="https://spdx.org/licenses/"/>
</rdf:Description>
<rdf:Description rdf:about="https://spdx.org/licenses/EPL-1.0">
<rdf:about>https://spdx.org/licenses/EPL-1.0</rdf:about>
<rdfs:label xml:lang="en">Eclipse Public License 1.0</rdfs:label>
<rdf:resource>http://purl.org/dc/terms/LicenseDocument</rdf:resource>
<rdf:resource>http://purl.org/dc/terms/RightsDocument</rdf:resource>
<rdf:type rdf:resource="https://spdx.org/licenses/"/>
</rdf:Description>
<rdf:Description rdf:about="https://spdx.org/licenses/GPL-3.0">
<rdf:about>https://spdx.org/licenses/AGPL-3.0</rdf:about>
<rdfs:label xml:lang="en">GNU Affero General Public License v3.0</rdfs:label>
<rdf:resource>http://purl.org/dc/terms/LicenseDocument</rdf:resource>
<rdf:resource>http://purl.org/dc/terms/RightsDocument</rdf:resource>
<rdf:type rdf:resource="https://spdx.org/licenses/"/>
</rdf:Description>
<rdf:Description rdf:about="https://spdx.org/licenses/GPL-2.0">
<rdf:about>https://spdx.org/licenses/GPL-2.0</rdf:about>
<rdfs:label xml:lang="en">GNU General Public License v2.0</rdfs:label>
<rdf:resource>http://purl.org/dc/terms/LicenseDocument</rdf:resource>
<rdf:resource>http://purl.org/dc/terms/RightsDocument</rdf:resource>
<rdf:type rdf:resource="https://spdx.org/licenses/"/>
</rdf:Description>
<rdf:Description rdf:about="https://spdx.org/licenses/LGPL-2.1">
<rdf:about>https://spdx.org/licenses/LGPL-2.1</rdf:about>
<rdfs:label xml:lang="en">GNU Lesser General Public License v2.1</rdfs:label>
<rdf:resource>http://purl.org/dc/terms/LicenseDocument</rdf:resource>
<rdf:resource>http://purl.org/dc/terms/RightsDocument</rdf:resource>
<rdf:type rdf:resource="https://spdx.org/licenses/"/>
</rdf:Description>
<rdf:Description rdf:about="https://spdx.org/licenses/LGPL-3.0">
<rdf:about>https://spdx.org/licenses/LGPL-3.0</rdf:about>
<rdfs:label xml:lang="en">GNU Lesser General Public License v3.0</rdfs:label>
<rdf:resource>http://purl.org/dc/terms/LicenseDocument</rdf:resource>
<rdf:resource>http://purl.org/dc/terms/RightsDocument</rdf:resource>
<rdf:type rdf:resource="https://spdx.org/licenses/"/>
</rdf:Description>
<rdf:Description rdf:about="https://spdx.org/licenses/MPL-2.0">
<rdf:about>https://spdx.org/licenses/MPL-2.0</rdf:about>
<rdfs:label xml:lang="en">Mozilla Public License 2.0</rdfs:label>
<rdf:resource>http://purl.org/dc/terms/LicenseDocument</rdf:resource>
<rdf:resource>http://purl.org/dc/terms/RightsDocument</rdf:resource>
<rdf:type rdf:resource="https://spdx.org/licenses/"/>
</rdf:Description>
<rdf:Description rdf:about="https://spdx.org/licenses/Unlicense">
<rdf:about>https://spdx.org/licenses/Unlicense</rdf:about>
<rdfs:label xml:lang="en">The Unlicense</rdfs:label>
<rdf:resource>http://purl.org/dc/terms/LicenseDocument</rdf:resource>
<rdf:resource>http://purl.org/dc/terms/RightsDocument</rdf:resource>
<rdf:type rdf:resource="https://spdx.org/licenses/"/>
</rdf:Description>
</rdf:RDF>
\ No newline at end of file
This diff is collapsed.
using FluentMigrator;
namespace Coscine.Database.Migration.Migrations
{
//yyyymmddhhmm
[Migration(201907011352)]
public class Migration201907011352ProjectApi : FluentMigrator.Migration
{
public override void Down()
{
#region Foreign Keys
Delete.ForeignKey()
.FromTable("Resources").ForeignColumn("TypeId")
.ToTable("ResourceTypes").PrimaryColumn("Id");
Delete.ForeignKey()
.FromTable("SubProjects").ForeignColumn("ProjectId")
.ToTable("Projects").PrimaryColumn("Id");
Delete.ForeignKey()
.FromTable("SubProjects").ForeignColumn("SubProjectId")
.ToTable("Projects").PrimaryColumn("Id");
Delete.ForeignKey()
.FromTable("ProjectResource").ForeignColumn("ResourceId")
.ToTable("Resources").PrimaryColumn("Id");
Delete.ForeignKey()
.FromTable("ProjectResource").ForeignColumn("ProjectId")
.ToTable("Projects").PrimaryColumn("Id");
Delete.ForeignKey()
.FromTable("ProjectRoles").ForeignColumn("ProjectId")
.ToTable("Projects").PrimaryColumn("Id");
Delete.ForeignKey()
.FromTable("ProjectRoles").ForeignColumn("UserId")
.ToTable("Users").PrimaryColumn("Id");
Delete.ForeignKey()
.FromTable("ProjectRoles").ForeignColumn("RoleId")
.ToTable("Roles").PrimaryColumn("Id");
#endregion
#region Tables
Delete.Table("ResourceTypes");
Delete.Table("Projects");
Delete.Table("Users");
Delete.Table("Roles");
Delete.Table("Resources");
Delete.Table("SubProjects");
Delete.Table("ProjectResource");
Delete.Table("ProjectRoles");
#endregion
}
public override void Up()
{
#region Independent Tables
Create.Table("ResourceTypes")
.WithColumn("Id").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid)
.WithColumn("DisplayName").AsString(50).NotNullable();
Create.Table("Projects")
.WithColumn("Id").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid)
.WithColumn("DisplayName").AsString(200).NotNullable()
.WithColumn("Description").AsString(1000).NotNullable()
.WithColumn("Organization").AsString(50).NotNullable();
Create.Table("Users")
.WithColumn("Id").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid);
Create.Table("Roles")
.WithColumn("Id").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid)
.WithColumn("DisplayName").AsString(50).NotNullable()
.WithColumn("Description").AsString(50).NotNullable();
Insert.IntoTable("Roles").Row(new { DisplayName = "Owner", Description = "Owner of the project." });
Insert.IntoTable("Roles").Row(new { DisplayName = "Member", Description = "Member of the project." });
#endregion
#region Resources
Create.Table("Resources")
.WithColumn("Id").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid)
.WithColumn("Url").AsString(200).NotNullable()
.WithColumn("ExternalId").AsString(200).NotNullable()
.WithColumn("TypeId").AsGuid().NotNullable();
Create.ForeignKey()
.FromTable("Resources").ForeignColumn("TypeId")
.ToTable("ResourceTypes").PrimaryColumn("Id");
#endregion
#region SubProjects
Create.Table("SubProjects")
.WithColumn("RelationId").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid)
.WithColumn("ProjectId").AsGuid().NotNullable()
.WithColumn("SubProjectId").AsGuid().NotNullable();
Create.ForeignKey()
.FromTable("SubProjects").ForeignColumn("ProjectId")
.ToTable("Projects").PrimaryColumn("Id");
Create.ForeignKey()
.FromTable("SubProjects").ForeignColumn("SubProjectId")
.ToTable("Projects").PrimaryColumn("Id");
#endregion
#region ProjectResource
Create.Table("ProjectResource")
.WithColumn("RelationId").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid)
.WithColumn("ResourceId").AsGuid().NotNullable()
.WithColumn("ProjectId").AsGuid().NotNullable();
Create.ForeignKey()
.FromTable("ProjectResource").ForeignColumn("ResourceId")
.ToTable("Resources").PrimaryColumn("Id");
Create.ForeignKey()
.FromTable("ProjectResource").ForeignColumn("ProjectId")
.ToTable("Projects").PrimaryColumn("Id");
#endregion
#region ProjectRoles
Create.Table("ProjectRoles")
.WithColumn("RelationId").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid)
.WithColumn("ProjectId").AsGuid().NotNullable()
.WithColumn("UserId").AsGuid().NotNullable()
.WithColumn("RoleId").AsGuid().NotNullable();
Create.ForeignKey()
.FromTable("ProjectRoles").ForeignColumn("ProjectId")
.ToTable("Projects").PrimaryColumn("Id");
Create.ForeignKey()
.FromTable("ProjectRoles").ForeignColumn("UserId")
.ToTable("Users").PrimaryColumn("Id");
Create.ForeignKey()
.FromTable("ProjectRoles").ForeignColumn("RoleId")
.ToTable("Roles").PrimaryColumn("Id");
#endregion
}
}
}
using FluentMigrator;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Coscine.Database.Migration.Migrations
{
//yyyymmddhhmm
[Migration(201907081510)]
public class Migration201907081510EnhanceProjectApi : FluentMigrator.Migration
{
public override void Down()
{
Delete.Column("StartDate").FromTable("Projects");
Delete.Column("EndDate").FromTable("Projects");
Delete.Column("Keywords").FromTable("Projects");
}
public override void Up()
{
Alter.Table("Projects")
.AddColumn("StartDate").AsDateTime().WithDefault(SystemMethods.CurrentDateTime)
.AddColumn("EndDate").AsDateTime()
.AddColumn("Keywords").AsString(1000);
}
}
}
using FluentMigrator;
namespace Coscine.Database.Migration.Migrations
{
//yyyymmddhhmm
[Migration(201907100900)]
public class Migration201907100900UserProfilesApi : FluentMigrator.Migration
{
public override void Down()
{
#region Foreign Keys
Delete.ForeignKey()
.FromTable("GroupMemberships").ForeignColumn("UserId")
.ToTable("Users").PrimaryColumn("Id");
Delete.ForeignKey()
.FromTable("GroupMemberships").ForeignColumn("GroupId")
.ToTable("Groups").PrimaryColumn("Id");
Delete.ForeignKey()
.FromTable("ExternalIds").ForeignColumn("UserId")
.ToTable("Users").PrimaryColumn("Id");
Delete.ForeignKey()
.FromTable("ExternalIds").ForeignColumn("ResourceTypeId")
.ToTable("ExternalAuthenticators").PrimaryColumn("Id");
#endregion
#region Tables
Delete.Table("Groups");
Delete.Table("GroupMemberships");
Delete.Table("ExternalAuthenticators");
Delete.Table("ExternalIds");
#endregion
#region Columns
Delete.Column("EmailAddress").FromTable("Users");
Delete.Column("DisplayName").FromTable("Users");
#endregion
}
public override void Up()
{
#region Existing Tables
Alter.Table("Users")
.AddColumn("EmailAddress").AsString(255).NotNullable()
.AddColumn("DisplayName").AsString(255).NotNullable();
#endregion
#region Independent Tables
Create.Table("Groups")
.WithColumn("Id").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid)
.WithColumn("DisplayName").AsString(255).NotNullable();
Create.Table("ExternalAuthenticators")
.WithColumn("Id").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid)
.WithColumn("DisplayName").AsString(50).NotNullable();
#endregion
#region GroupMemberships
Create.Table("GroupMemberships")
.WithColumn("RelationId").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid)
.WithColumn("GroupId").AsGuid().NotNullable()
.WithColumn("UserId").AsGuid().NotNullable();
Create.ForeignKey()
.FromTable("GroupMemberships").ForeignColumn("UserId")
.ToTable("Users").PrimaryColumn("Id");
Create.ForeignKey()
.FromTable("GroupMemberships").ForeignColumn("GroupId")
.ToTable("Groups").PrimaryColumn("Id");
#endregion
#region ExternalIds
Create.Table("ExternalIds")
.WithColumn("RelationId").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid)
.WithColumn("UserId").AsGuid().NotNullable()
.WithColumn("ResourceTypeId").AsGuid().NotNullable()
.WithColumn("ExternalId").AsString(255);
Create.ForeignKey()
.FromTable("ExternalIds").ForeignColumn("UserId")
.ToTable("Users").PrimaryColumn("Id");
Create.ForeignKey()
.FromTable("ExternalIds").ForeignColumn("ResourceTypeId")
.ToTable("ExternalAuthenticators").PrimaryColumn("Id");
#endregion
}
}
}
using FluentMigrator;
namespace Coscine.Database.Migration.Migrations
{
//yyyymmddhhmm
[Migration(201908071616)]
public class Migration201908071616RdsResource : FluentMigrator.Migration
{
public override void Down()
{
Delete.FromTable("ResourceTypes").Row(new { DisplayName = "rds" });
}
public override void Up()
{
Insert.IntoTable("ResourceTypes").Row(new { DisplayName = "rds" });
}
}
}
using FluentMigrator;
namespace Coscine.Database.Migration.Migrations
{
//yyyymmddhhmm
[Migration(201908121401)]
public class Migration201908121401GitlabResource : FluentMigrator.Migration
{
public override void Down()
{
Delete.FromTable("ResourceTypes").Row(new { DisplayName = "gitlab" });
}
public override void Up()
{
Insert.IntoTable("ResourceTypes").Row(new { DisplayName = "gitlab" });
}
}
}
using FluentMigrator;
namespace Coscine.Database.Migration.Migrations
{
//yyyymmddhhmm
[Migration(201908231520)]
public class Migration201908231520ResourceDisplayName : FluentMigrator.Migration
{
public override void Down()
{
Delete.Column("DisplayName").FromTable("Resources");
}
public override void Up()
{
Alter.Table("Resources").AddColumn("DisplayName").AsString(200).Nullable();
}
}
}
using FluentMigrator;
namespace Coscine.Database.Migration.Migrations
{
//yyyymmddhhmm
[Migration(201908290941)]
public class Migration201908290941ORCiD : FluentMigrator.Migration
{
public override void Down()
{
Rename.Column("ExternalAuthenticatorId").OnTable("ExternalIds").To("ResourceTypeId");
Delete.FromTable("ExternalAuthenticators").Row(new { DisplayName = "ORCiD" });
}
public override void Up()
{
Rename.Column("ResourceTypeId").OnTable("ExternalIds").To("ExternalAuthenticatorId");
Insert.IntoTable("ExternalAuthenticators").Row(new { DisplayName = "ORCiD" });
}
}
}
using FluentMigrator;
namespace Coscine.Database.Migration.Migrations
{
//yyyymmddhhmm
[Migration(201909111125)]
public class Migration201909111125ProjectEnhancement : FluentMigrator.Migration
{
public override void Down()
{
#region Foreign Keys
Delete.ForeignKey()
.FromTable("ProjectDiscipline").ForeignColumn("DisciplineId")
.ToTable("Disciplines").PrimaryColumn("Id");
Delete.ForeignKey()
.FromTable("ProjectDiscipline").ForeignColumn("ProjectId")
.ToTable("Projects").PrimaryColumn("Id");
Delete.ForeignKey()
.FromTable("ProjectInstitute").ForeignColumn("InstituteId")
.ToTable("Institutes").PrimaryColumn("Id");
Delete.ForeignKey()
.FromTable("ProjectInstitute").ForeignColumn("ProjectId")
.ToTable("Projects").PrimaryColumn("Id");
Delete.ForeignKey()
.FromTable("Projects").ForeignColumn("VisibilityId")