Commit 9fda14fc authored by L. Ellenbeck's avatar L. Ellenbeck
Browse files

added quota migration

parent 76a35749
......@@ -17,6 +17,8 @@
</PropertyGroup>
<ItemGroup>
<None Remove="Migrations\Migration202106091057QuotaColumn_up.sql" />
<None Remove="Migrations\Migration202109161043UdeResources_down.sql" />
<None Remove="Migrations\Migration202109161043UdeResources_up.sql" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Assets\dfg_structure.rdf" />
......@@ -28,6 +30,8 @@
<EmbeddedResource Include="Migrations\Migration202101181145DFNAAI_up.sql" />
<EmbeddedResource Include="Migrations\Migration202102101200RdsS3_down.sql" />
<EmbeddedResource Include="Migrations\Migration202102101200RdsS3_up.sql" />
<EmbeddedResource Include="Migrations\Migration202109161043UdeResources_down.sql" />
<EmbeddedResource Include="Migrations\Migration202109161043UdeResources_up.sql" />
<EmbeddedResource Include="Migrations\Migration202106091057QuotaColumn_up.sql" />
<EmbeddedResource Include="Migrations\Migration202104010900RdsS3Fix_up.sql" />
</ItemGroup>
......
......@@ -9,6 +9,8 @@ namespace Coscine.Migrations.Migrations
{
public override void Down()
{
Execute.EmbeddedScript("Migration202109161043UdeResources_down.sql");
Delete.Column("AccessKey").FromTable("RDSResourceType");
Delete.Column("SecretKey").FromTable("RDSResourceType");
Delete.Column("Endpoint").FromTable("RDSResourceType");
......@@ -41,6 +43,9 @@ namespace Coscine.Migrations.Migrations
// Add resourcetypes
Insert.IntoTable("ResourceTypes").Row(new { DisplayName = "rdss3ude" });
Insert.IntoTable("ResourceTypes").Row(new { DisplayName = "rdsude" });
// Add quotas
Execute.EmbeddedScript("Migration202109161043UdeResources_up.sql");
}
}
}
DECLARE @rdsS3udeId AS uniqueidentifier
SELECT @rdsS3udeId = [Id]
FROM [dbo].[ResourceTypes]
WHERE [DisplayName] = 'rdss3ude';
DECLARE @rdsudeId AS uniqueidentifier
SELECT @rdsudeId = [Id]
FROM [dbo].[ResourceTypes]
WHERE [DisplayName] = 'rdsude';
DELETE FROM [dbo].[ProjectQuotas]
WHERE [ResourceTypeId] = @rdsS3udeId OR [ResourceTypeId] = @rdsudeId
\ No newline at end of file
DECLARE @rdsS3udeId AS uniqueidentifier
SELECT @rdsS3udeId = [Id]
FROM [dbo].[ResourceTypes]
WHERE [DisplayName] = 'rdss3ude';
DECLARE @rdsudeId AS uniqueidentifier
SELECT @rdsudeId = [Id]
FROM [dbo].[ResourceTypes]
WHERE [DisplayName] = 'rdsude';
INSERT INTO [ProjectQuotas]
([ProjectId]
,[ResourceTypeId]
,[Quota]
,[MaxQuota])
SELECT [Id], @rdsS3udeId, 0, 0
FROM [Projects]
INSERT INTO [ProjectQuotas]
([ProjectId]
,[ResourceTypeId]
,[Quota]
,[MaxQuota])
SELECT [Id], @rdsudeId, 0, 0
FROM [Projects]
\ No newline at end of file
......@@ -3,6 +3,14 @@
"Migrator": {
"commandName": "Project",
"commandLineArgs": "--migrate_up"
},
"Migrator up": {
"commandName": "Project",
"commandLineArgs": "--migrate_up"
},
"Migrator down": {
"commandName": "Project",
"commandLineArgs": "--roll_back 1"
}
}
}
\ 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