namespace FtxDemo.Migrations {
    using System;
    using System.Data.Entity.Migrations;

    public partial class SetupFulltext : DbMigration {
        public override void Up() {
            // Create fulltext catalog; all operations must be run outside the main migration transaction
            this.Sql("CREATE FULLTEXT CATALOG DefaultCatalog WITH ACCENT_SENSITIVITY=OFF AS DEFAULT", suppressTransaction: true);

            // Create fulltext index on default catalog, with default stoplist and with automatic change tracking
            this.Sql("CREATE FULLTEXT INDEX ON Stories (Title LANGUAGE Czech, Body LANGUAGE Czech) KEY INDEX [PK_dbo.Stories]", suppressTransaction: true);
        }

        public override void Down() {
            // Delete fulltext index
            this.Sql("DROP FULLTEXT INDEX ON Stories", suppressTransaction: true);

            // Delete fulltext catalog
            this.Sql("DROP FULLTEXT CATALOG DefaultCatalog", suppressTransaction: true);
        }
    }
}
