Skip to content
Snippets Groups Projects
Commit 9eb743b2 authored by Petar Hristov's avatar Petar Hristov :speech_balloon:
Browse files

Merge remote-tracking branch 'remotes/origin/dev' into Issue/2355-topLevelOrg

# Conflicts:
#	src/Migrations/Migrations.csproj
parents fcb75564 2f5668ee
No related branches found
No related tags found
1 merge request!104Fix: Allowing only top-level organizations under participating organizations
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<RootNamespace>Coscine.Migrations</RootNamespace>
......@@ -30,6 +30,7 @@
<None Remove="Migrations\Migration202205051431WormResourceType_up.sql" />
<None Remove="Migrations\Migration202207191035GitlabResourceType_down.sql" />
<None Remove="Migrations\Migration202207191035GitlabResourceType_up.sql" />
<None Remove="Migrations\Migration202302271031RemDupGitlabProjectQuotas_up.sql" />
<None Remove="Migrations\Migration202302271200TopLevelProjectOrganizations_up.sql" />
</ItemGroup>
......@@ -56,6 +57,7 @@
<EmbeddedResource Include="Migrations\Migration202201241220TuDoResources_up.sql" />
<EmbeddedResource Include="Migrations\Migration202201190837NRWFHResources_down.sql" />
<EmbeddedResource Include="Migrations\Migration202201190837NRWFHResources_up.sql" />
<EmbeddedResource Include="Migrations\Migration202302271031RemDupGitlabProjectQuotas_up.sql" />
<EmbeddedResource Include="Migrations\Migration202302271200TopLevelProjectOrganizations_up.sql" />
</ItemGroup>
......
using FluentMigrator;
namespace Coscine.Migrations.Migrations
{
//yyyymmddhhmm
[Migration(202302271031)]
public class Migration202302271031RemDupGitlabProjectQuotas : Migration
{
public override void Down()
{
}
public override void Up()
{
Execute.EmbeddedScript("Migration202302271031RemDupGitlabProjectQuotas_up.sql");
}
}
}
\ No newline at end of file
DELETE FROM [dbo].[ProjectQuotas] WHERE [RelationId] IN (
SELECT [RelationId] FROM (
SELECT
[RelationId]
, Count(*) OVER (PARTITION BY [ProjectId], [ResourceTypeId] ORDER BY [MaxQuota] DESC) AS [quantity]
FROM
[dbo].[ProjectQuotas]
) a WHERE [quantity] > 1
)
\ No newline at end of file
using FluentMigrator;
namespace Coscine.Migrations.Migrations
{
//yyyymmddhhmm
[Migration(202302271048)]
public class Migration202302271048UniqueConstraintProjectQuotass : Migration
{
public override void Down()
{
Delete.UniqueConstraint("ProjectIdResourceTypeId").FromTable("ProjectQuotas").Columns("ProjectId", "ResourceTypeId");
}
public override void Up()
{
Create.UniqueConstraint("ProjectIdResourceTypeId").OnTable("ProjectQuotas").Columns("ProjectId", "ResourceTypeId");
}
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment