Skip to content
Snippets Groups Projects
Commit 04f402c1 authored by Marcel Nellesen's avatar Marcel Nellesen
Browse files

Merge branch 'Sprint/201921' into 'master'

Sprint/201921

See merge request coscine/cs/database!31
parents 827337b3 cce70c98
No related branches found
No related tags found
1 merge request!31Sprint/201921
......@@ -36,8 +36,8 @@ If you want to change the database for which the data model should be created, y
The fluent migrator provides a command line tool for handling database migrations.
Currently, it provides an intermediary interface for utilizing the fluentMigrator up migration (down migration is currently not supported by us) as well as its rollback function, using the command line arguments:
```
-migrate_up
-roll_back <number of roll back steps>
--migrate_up
--roll_back <number of roll back steps>
```
FluentMigrator will look for migrations in the Migrations directory. While it is, in principle, possible to call the our migrator from other projects as well, it is recommended to have all migrations in this project for greater cohesion and in order to make sure that the data model stays up-to-date.
Migrations should be identified by a unique id which corresponds, roughly, to the date and time of its implementation. The format is:
......
using FluentMigrator;
namespace Coscine.Database.Migration.Migrations
{
//yyyymmddhhmm
[Migration(201910241600)]
public class Migration201910241600ResourceMetadata : FluentMigrator.Migration
{
public override void Down()
{
Delete.Column("ApplicationProfile").FromTable("Resources");
Delete.Column("FixedValues").FromTable("Resources");
}
public override void Up()
{
Alter.Table("Resources").AddColumn("ApplicationProfile").AsString(500).Nullable();
Alter.Table("Resources").AddColumn("FixedValues").AsString(5000).Nullable();
}
}
}
......@@ -155,6 +155,7 @@
<Compile Include="Migrations\Migration201907100900UserProfilesApi.cs" />
<Compile Include="Migrations\Migration201908231520ResourceDisplayName.cs" />
<Compile Include="Migrations\Migration201910161154InstitutesDisciplines.cs" />
<Compile Include="Migrations\Migration201910241600ResourceMetadata.cs" />
<Compile Include="Migrations\Migration201911040900EnglishDFG.cs" />
<Compile Include="Migrator.cs" />
<Compile Include="Program.cs" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment