Beispiel #1
0
        /// <summary>
        ///     Creates a new <see cref="AddPrimaryKeyOperation"/> from the specified primary key.
        /// </summary>
        /// <param name="primaryKey"> The primary key. </param>
        /// <returns> The operation. </returns>
        public static AddPrimaryKeyOperation CreateFrom([NotNull] IPrimaryKeyConstraint primaryKey)
        {
            Check.NotNull(primaryKey, nameof(primaryKey));

            var operation = new AddPrimaryKeyOperation
            {
                Schema  = primaryKey.Table.Schema,
                Table   = primaryKey.Table.Name,
                Name    = primaryKey.Name,
                Columns = primaryKey.Columns.Select(c => c.Name).ToArray()
            };

            operation.AddAnnotations(primaryKey.GetAnnotations());

            return(operation);
        }
 protected override void Generate(AddPrimaryKeyOperation operation, IModel model, MigrationCommandListBuilder builder)
 {
     throw new NotSupportedException(SqliteStrings.InvalidMigrationOperation(operation.GetType().Name));
 }