Commit 33e751f0 authored by L. Ellenbeck's avatar L. Ellenbeck
Browse files

Update: added api token migration coscine/issues#1125

parent 53fff78e
......@@ -205,6 +205,7 @@
<Compile Include="Migrations\Migration202005281400ProjectUrl.cs" />
<Compile Include="Migrations\Migration202006261208ProjectQuotas.cs" />
<Compile Include="CoscineMigrations.cs" />
<Compile Include="Migrations\Migration202010271100ApiTokens.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
......
using FluentMigrator;
namespace Coscine.Migrations.Migrations
{
//yyyymmddhhmm
[Migration(202010271100)]
public class Migration202010271100ApiTokens : Migration
{
public override void Down()
{
Delete.Table("ApiTokens");
}
public override void Up()
{
Create.Table("ApiTokens")
.WithColumn("Id").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid)
.WithColumn("UserId").AsGuid().NotNullable()
.WithColumn("Creation").AsDateTime().NotNullable()
.WithColumn("Expiration").AsDateTime().NotNullable();
Create.ForeignKey()
.FromTable("ApiTokens").ForeignColumn("UserId")
.ToTable("Users").PrimaryColumn("Id");
}
}
}
Supports Markdown
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