Skip to content
Snippets Groups Projects
Commit beca0400 authored by Marcel Nellesen's avatar Marcel Nellesen
Browse files

New: Add Attributes for Shibboleth Integration (coscine/issues#525)

New: Altered DB for Bucket Application (coscine/issues#526)
parent de93e557
Branches
Tags
No related merge requests found
using FluentMigrator;
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Xml;
using System.Xml.Linq;
#region DupFinder Exclusion
namespace Coscine.Database.Migration.Migrations
{
//yyyymmddhhmm
[Migration(201912060900)]
public class Migration201912060900BucketApplication : FluentMigrator.Migration
{
public override void Down()
{
// update the resource type table
Delete.FromTable("ResourceTypes").Row(new { DisplayName = "rds" });
Update.Table("ResourceTypes").Set(new { DisplayName = "rds" }).Where(new { DisplayName = "s3" });
// deletion of the table
Delete.Table("RDSResourceType");
// renaming of the s3resource table
Rename.Table("S3ResourceType").To("RDSResourceType");
Execute.Sql("EXEC sp_rename 'DF_S3ResourceType_Id','DF_RDSResourceType_Id', 'object'");
Execute.Sql("EXEC sp_rename N'PK_S3ResourceType', 'PK_RDSResourceType', 'object';");
}
public override void Up()
{
// update the resource type table
Update.Table("ResourceTypes").Set(new { DisplayName = "s3" }).Where(new { DisplayName = "rds" });
Insert.IntoTable("ResourceTypes").Row(new { DisplayName = "rds" });
// renaming of the rdsresource table
Rename.Table("RDSResourceType").To("S3ResourceType");
Execute.Sql("EXEC sp_rename 'DF_RDSResourceType_Id','DF_S3ResourceType_Id', 'object'");
Execute.Sql("EXEC sp_rename N'PK_RDSResourceType', 'PK_S3ResourceType', 'object';");
// creation of the new table
Create.Table("RDSResourceType")
.WithColumn("Id").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid)
.WithColumn("BucketName").AsString(63).NotNullable()
.WithColumn("Size").AsInt32().Nullable();
}
}
}
#endregion
\ No newline at end of file
using FluentMigrator;
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Xml;
using System.Xml.Linq;
#region DupFinder Exclusion
namespace Coscine.Database.Migration.Migrations
{
//yyyymmddhhmm
[Migration(201912091553)]
public class Migration201912091553ShibbolethAddition : FluentMigrator.Migration
{
public override void Down()
{
Delete.FromTable("ExternalAuthenticators").Row(new { DisplayName = "Shibboleth" });
Delete.Column("Entitlement").FromTable("Users");
Delete.Column("Organization").FromTable("Users");
}
public override void Up()
{
Insert.IntoTable("ExternalAuthenticators").Row(new { DisplayName = "Shibboleth" });
Alter.Table("Users").AddColumn("Entitlement").AsString(200).Nullable();
Alter.Table("Users").AddColumn("Organization").AsString(200).Nullable();
}
}
}
#endregion
\ No newline at end of file
......@@ -157,6 +157,8 @@
<Compile Include="Migrations\Migration201910161154InstitutesDisciplines.cs" />
<Compile Include="Migrations\Migration201910241600ResourceMetadata.cs" />
<Compile Include="Migrations\Migration201911040900EnglishDFG.cs" />
<Compile Include="Migrations\Migration201912060900BucketApplication.cs" />
<Compile Include="Migrations\Migration201912091553ShibbolethAddition.cs" />
<Compile Include="Migrator.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment