Commit e825880b authored by Marcel Nellesen's avatar Marcel Nellesen
Browse files

New: Fds S3 migration coscine/issues#1292

parent 1a5e12e3
......@@ -23,6 +23,8 @@
<EmbeddedResource Include="Migrations\Migration202005281400ProjectUrl_up.sql" />
<EmbeddedResource Include="Migrations\Migration202006261208ProjectQuotas_up.sql" />
<EmbeddedResource Include="Migrations\Migration202101181145DFNAAI_up.sql" />
<EmbeddedResource Include="Migrations\Migration202102101200RdsS3_down.sql" />
<EmbeddedResource Include="Migrations\Migration202102101200RdsS3_up.sql" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Coscine.Configuration" Version="2.*-*" />
......
using FluentMigrator;
namespace Coscine.Migrations.Migrations
{
//yyyymmddhhmm
[Migration(202102101200)]
public class Migration202102101200RdsS3 : Migration
{
public override void Down()
{
Execute.EmbeddedScript("Migration202102101200RdsS3_down.sql");
Delete.FromTable("ResourceTypes").Row(new { DisplayName = "rdss3" });
Delete.Table("RdsS3ResourceType");
}
public override void Up()
{
Create.Table("RdsS3ResourceType")
.WithColumn("Id").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid)
.WithColumn("BucketName").AsString(63).NotNullable()
.WithColumn("AccessKey").AsString(200).NotNullable()
.WithColumn("SecretKey").AsString(200).NotNullable()
.WithColumn("AccessKeyRead").AsString(200).NotNullable()
.WithColumn("SecretKeyRead").AsString(200).NotNullable()
.WithColumn("AccessKeyWrite").AsString(200).NotNullable()
.WithColumn("SecretKeyWrite").AsString(200).NotNullable()
.WithColumn("Endpoint").AsString(200).NotNullable()
.WithColumn("Size").AsInt32().NotNullable();
Insert.IntoTable("ResourceTypes").Row(new { DisplayName = "rdss3" });
Execute.EmbeddedScript("Migration202102101200RdsS3_up.sql");
}
}
}
DELETE FROM [dbo].[ProjectQuotas]
WHERE [dbo].[ProjectQuotas].ResourceTypeId =
ANY(
SELECT RT.[ID]
FROM [dbo].[ResourceTypes] RT
WHERE DisplayName='rdss3'
);
\ No newline at end of file
INSERT INTO ProjectQuotas ([ProjectId], [ResourceTypeId])
(
SELECT P.[Id], RT.[Id]
FROM Projects P, ResourceTypes RT
WHERE RT.[DisplayName] = 'rdss3'
);
\ No newline at end of file
Markdown is supported
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