public override void Generate(CreateTableOperation operation, IModel model, SqlBatchBuilder builder) { // Lifts a primary key definition into the typename. // This handles the quirks of creating integer primary keys using autoincrement, not default rowid behavior. if (operation.PrimaryKey?.Columns.Length == 1) { var columnOp = operation.Columns?.FirstOrDefault(o => o.Name == operation.PrimaryKey.Columns[0]); if (columnOp != null) { columnOp.AddAnnotation(SqliteAnnotationNames.Prefix + SqliteAnnotationNames.InlinePrimaryKey, true); operation.PrimaryKey = null; } } base.Generate(operation, model, builder); }
protected override void Generate(CreateTableOperation operation, IModel model, RelationalCommandListBuilder builder) { Check.NotNull(operation, nameof(operation)); Check.NotNull(builder, nameof(builder)); // Lifts a primary key definition into the typename. // This handles the quirks of creating integer primary keys using autoincrement, not default rowid behavior. if (operation.PrimaryKey?.Columns.Length == 1) { var columnOp = operation.Columns.FirstOrDefault(o => o.Name == operation.PrimaryKey.Columns[0]); if (columnOp != null) { columnOp.AddAnnotation(SqliteAnnotationNames.Prefix + SqliteAnnotationNames.InlinePrimaryKey, true); if (!string.IsNullOrEmpty(operation.PrimaryKey.Name)) { columnOp.AddAnnotation(SqliteAnnotationNames.Prefix + SqliteAnnotationNames.InlinePrimaryKeyName, operation.PrimaryKey.Name); } operation.PrimaryKey = null; } } base.Generate(operation, model, builder); }
public ColumnsBuilder([NotNull] CreateTableOperation createTableOperation) { Check.NotNull(createTableOperation, nameof(createTableOperation)); _createTableOperation = createTableOperation; }