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
585a81cf
Commit
585a81cf
authored
Jun 26, 2020
by
Benedikt Heinrichs
Browse files
New: Add project quotas definitions (coscine/issues#858)
parent
6a8d49c1
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/Migrator/Migrations/Migration202006261208ProjectQuotas.cs
0 → 100644
View file @
585a81cf
using
FluentMigrator
;
namespace
Coscine.Database.Migration.Migrations
{
//yyyymmddhhmm
[
Migration
(
202006261208
)]
public
class
Migration202006261208ProjectQuotas
:
FluentMigrator
.
Migration
{
public
override
void
Down
()
{
Delete
.
Table
(
"ProjectQuotas"
);
}
public
override
void
Up
()
{
Create
.
Table
(
"ProjectQuotas"
)
.
WithColumn
(
"RelationId"
).
AsGuid
().
PrimaryKey
().
WithDefault
(
SystemMethods
.
NewGuid
)
.
WithColumn
(
"ProjectId"
).
AsGuid
().
NotNullable
()
.
WithColumn
(
"ResourceTypeId"
).
AsGuid
().
NotNullable
()
.
WithColumn
(
"Quota"
).
AsInt32
().
NotNullable
().
WithDefaultValue
(
25
);
Create
.
ForeignKey
()
.
FromTable
(
"ProjectQuotas"
).
ForeignColumn
(
"ProjectId"
)
.
ToTable
(
"Projects"
).
PrimaryColumn
(
"Id"
);
Create
.
ForeignKey
()
.
FromTable
(
"ProjectQuotas"
).
ForeignColumn
(
"ResourceTypeId"
)
.
ToTable
(
"ResourceTypes"
).
PrimaryColumn
(
"Id"
);
Execute
.
EmbeddedScript
(
"Migration202006261208ProjectQuotas_up.sql"
);
}
}
}
src/Migrator/Migrations/Migration202006261208ProjectQuotas_up.sql
0 → 100644
View file @
585a81cf
INSERT
INTO
[
Coscine
].[
dbo
].[
ProjectQuotas
]
([
ProjectId
],
[
ResourceTypeId
])
(
SELECT
P
.[
Id
],
RT
.[
Id
]
FROM
[
Coscine
].[
dbo
].[
Projects
]
P
,
[
Coscine
].[
dbo
].[
ResourceTypes
]
RT
);
\ No newline at end of file
src/Migrator/Migrator.csproj
View file @
585a81cf
...
...
@@ -173,6 +173,7 @@
<Compile
Include=
"Migrations\Migration202004151354S3ResourceUrl.cs"
/>
<Compile
Include=
"Migrations\Migration202003192117ORCiDEmailAddress.cs"
/>
<Compile
Include=
"Migrations\Migration202005251520TOS.cs"
/>
<Compile
Include=
"Migrations\Migration202006261208ProjectQuotas.cs"
/>
<Compile
Include=
"Migrator.cs"
/>
<Compile
Include=
"Program.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
...
...
@@ -190,6 +191,9 @@
<ItemGroup>
<EmbeddedResource
Include=
"Migrations\Migration202003121255ActivatedFeatures_up.sql"
/>
</ItemGroup>
<ItemGroup>
<EmbeddedResource
Include=
"Migrations\Migration202006261208ProjectQuotas_up.sql"
/>
</ItemGroup>
<Import
Project=
"$(MSBuildToolsPath)\Microsoft.CSharp.targets"
/>
<Import
Project=
"..\packages\FluentMigrator.Runner.SqlServerCe.3.1.3\build\netstandard2.0\FluentMigrator.Runner.SqlServerCe.targets"
Condition=
"Exists('..\packages\FluentMigrator.Runner.SqlServerCe.3.1.3\build\netstandard2.0\FluentMigrator.Runner.SqlServerCe.targets')"
/>
<Target
Name=
"EnsureNuGetPackageBuildImports"
BeforeTargets=
"PrepareForBuild"
>
...
...
Write
Preview
Supports
Markdown
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