Skip to content

Commit b0ca412

Browse files
committed
support sqlite pk columns
1 parent 1074bf2 commit b0ca412

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/Migrator/Providers/Impl/SQLite/SQLiteTransformationProvider.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,18 @@ private void changeColumnInternal(string table, string[] old, IDbField[] columns
263263
ExecuteQuery(cmd, String.Format("ALTER TABLE {0}_temp RENAME TO {0}", table));
264264
}
265265

266+
public override void AddColumn(string table, Column column)
267+
{
268+
var backUp = column.ColumnProperty;
269+
var hasPkFlag = column.ColumnProperty.HasFlag(ColumnProperty.PrimaryKey);
270+
column.ColumnProperty &= ~ColumnProperty.PrimaryKey;
271+
base.AddColumn(table, column);
272+
column.ColumnProperty = backUp;
273+
if (hasPkFlag)
274+
{
275+
ChangeColumn(table, column);
276+
}
277+
}
266278

267279
public override void ChangeColumn(string table, Column column)
268280
{

0 commit comments

Comments
 (0)