Skip to content

Commit

Permalink
Merge pull request migratordotnet#9 from orient-man/master
Browse files Browse the repository at this point in the history
Make SchemaInfo upgrade work on SQLite
  • Loading branch information
jogibear9988 committed Jul 22, 2014
2 parents bd3e3a8 + 60b96f0 commit ab5612f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,12 @@ public override bool ConstraintExists(string table, string name)
return false;
}

public override string[] GetTables()
public override string[] GetConstraints(string table)
{
return new string[] { };
}

public override string[] GetTables()
{
var tables = new List<string>();

Expand Down
16 changes: 12 additions & 4 deletions src/Migrator.Providers/TransformationProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1362,11 +1362,19 @@ protected virtual void CreateSchemaInfoTable()
new Column("Scope", DbType.String, 50, ColumnProperty.NotNull | ColumnProperty.PrimaryKey, "default"),
new Column("TimeStamp", DbType.DateTime));
}
else if (!ColumnExists(_schemaInfotable, "Scope"))
else
{
AddColumn(_schemaInfotable, "Scope", DbType.String, 50, ColumnProperty.NotNull, "default");
RemoveAllConstraints(_schemaInfotable);
AddPrimaryKey("PK_SchemaInfo", _schemaInfotable, new[] { "Version", "Scope" });
if (!ColumnExists(_schemaInfotable, "Scope"))
{
AddColumn(_schemaInfotable, "Scope", DbType.String, 50, ColumnProperty.NotNull, "default");
RemoveAllConstraints(_schemaInfotable);
AddPrimaryKey("PK_SchemaInfo", _schemaInfotable, new[] { "Version", "Scope" });
}

if (!ColumnExists(_schemaInfotable, "TimeStamp"))
{
AddColumn(_schemaInfotable, "TimeStamp", DbType.DateTime);
}
}
}

Expand Down

0 comments on commit ab5612f

Please sign in to comment.