using FluentMigrator.Expressions; using FluentMigrator.Runner.Generators; using FluentMigrator.Runner.Generators.Generic; using FluentMigrator.Runner.Generators.SQLite; using Microsoft.Extensions.Options; namespace Your.CustomFluentMigratorClasses { /// /// An almost 1:1 copy from the FM project /// public class CustomSqliteGenerator : GenericGenerator { public CustomSqliteGenerator() : this(new SQLiteQuoter()) { } public CustomSqliteGenerator( SQLiteQuoter quoter) : this(quoter, new OptionsWrapper(new GeneratorOptions())) { } public CustomSqliteGenerator( SQLiteQuoter quoter, IOptions generatorOptions) : base(new CustomSqliteColumn(), quoter, new EmptyDescriptionGenerator(), generatorOptions) { } public override string RenameTable => "ALTER TABLE {0} RENAME TO {1}"; public override string Generate(AlterColumnExpression expression) { return CompatibilityMode.HandleCompatibilty("SQLite does not support alter column"); } public override string Generate(RenameColumnExpression expression) { return CompatibilityMode.HandleCompatibilty("SQLite does not support renaming of columns"); } public override string Generate(DeleteColumnExpression expression) { return CompatibilityMode.HandleCompatibilty("SQLite does not support deleting of columns"); } public override string Generate(AlterDefaultConstraintExpression expression) { return CompatibilityMode.HandleCompatibilty("SQLite does not support altering of default constraints"); } public override string Generate(CreateForeignKeyExpression expression) { return CompatibilityMode.HandleCompatibilty("Foreign keys are not supported in SQLite"); } public override string Generate(DeleteForeignKeyExpression expression) { return CompatibilityMode.HandleCompatibilty("Foreign keys are not supported in SQLite"); } public override string Generate(CreateSequenceExpression expression) { return CompatibilityMode.HandleCompatibilty("Sequences are not supported in SQLite"); } public override string Generate(DeleteSequenceExpression expression) { return CompatibilityMode.HandleCompatibilty("Sequences are not supported in SQLite"); } public override string Generate(DeleteDefaultConstraintExpression expression) { return CompatibilityMode.HandleCompatibilty("Default constraints are not supported"); } public override string Generate(CreateConstraintExpression expression) { return CompatibilityMode.HandleCompatibilty("Constraints are not supported"); } public override string Generate(DeleteConstraintExpression expression) { return CompatibilityMode.HandleCompatibilty("Constraints are not supported"); } } }