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
12dd989b
Commit
12dd989b
authored
Jun 15, 2021
by
L. Ellenbeck
Committed by
Petar Hristov
Jun 15, 2021
Browse files
NEW: Max quota column coscine/issues#1567
parent
c6ef9ccc
Changes
4
Show whitespace changes
Inline
Side-by-side
src/Migrations/Migrations.csproj
View file @
12dd989b
...
...
@@ -15,6 +15,9 @@
<PackageProjectUrl>https://git.rwth-aachen.de/coscine/backend/libraries/Migrations</PackageProjectUrl>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
</PropertyGroup>
<ItemGroup>
<None Remove="Migrations\Migration202106091057QuotaColumn_up.sql" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Assets\dfg_structure.rdf" />
<EmbeddedResource Include="Assets\Institutes.csv" />
...
...
@@ -25,6 +28,7 @@
<EmbeddedResource Include="Migrations\Migration202101181145DFNAAI_up.sql" />
<EmbeddedResource Include="Migrations\Migration202102101200RdsS3_down.sql" />
<EmbeddedResource Include="Migrations\Migration202102101200RdsS3_up.sql" />
<EmbeddedResource Include="Migrations\Migration202106091057QuotaColumn_up.sql" />
<EmbeddedResource Include="Migrations\Migration202104010900RdsS3Fix_up.sql" />
</ItemGroup>
<ItemGroup>
...
...
src/Migrations/Migrations/Migration202106091057QuotaColumn.cs
0 → 100644
View file @
12dd989b
using
FluentMigrator
;
namespace
Coscine.Migrations.Migrations
{
//yyyymmddhhmm
[
Migration
(
202106091057
)]
public
class
Migration202106091057QuotaColumn
:
Migration
{
public
override
void
Down
()
{
Delete
.
Column
(
"MaxQuota"
).
FromTable
(
"ProjectQuotas"
);
}
public
override
void
Up
()
{
Alter
.
Table
(
"ProjectQuotas"
)
.
AddColumn
(
"MaxQuota"
).
AsInt32
().
WithDefaultValue
(
"0"
).
NotNullable
();
Execute
.
EmbeddedScript
(
"Migration202106091057QuotaColumn_up.sql"
);
}
}
}
src/Migrations/Migrations/Migration202106091057QuotaColumn_up.sql
0 → 100644
View file @
12dd989b
DECLARE
@
rdsS3Id
AS
uniqueidentifier
SELECT
@
rdsS3Id
=
[
Id
]
FROM
[
dbo
].[
ResourceTypes
]
WHERE
[
DisplayName
]
=
'rdss3'
;
DECLARE
@
rdsId
AS
uniqueidentifier
SELECT
@
rdsId
=
[
Id
]
FROM
[
dbo
].[
ResourceTypes
]
WHERE
[
DisplayName
]
=
'rds'
;
UPDATE
[
dbo
].[
ProjectQuotas
]
SET
[
MaxQuota
]
=
100
WHERE
[
ResourceTypeId
]
=
@
rdsId
AND
[
Quota
]
>
0
AND
[
Quota
]
<=
100
;
UPDATE
[
dbo
].[
ProjectQuotas
]
SET
[
MaxQuota
]
=
[
Quota
]
WHERE
([
ResourceTypeId
]
=
@
rdsId
OR
[
ResourceTypeId
]
=
@
rdsS3Id
)
AND
[
MaxQuota
]
<
[
Quota
];
src/Migrator/Properties/launchSettings.json
0 → 100644
View file @
12dd989b
{
"profiles"
:
{
"Migrator"
:
{
"commandName"
:
"Project"
,
"commandLineArgs"
:
"--migrate_up"
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
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