public void InitializeAndRun()
        {
            // Arrange
            DbHelper.PrepareDatabase();

            // .. drop a column from one of the tables used by a view, so that the view installation will fail
            DbHelper.ExecuteQuery("ALTER TABLE [edfi].[GradingPeriod] DROP COLUMN [TotalInstructionalDays]");


            // Act
            (var success, _) = MigrationUtility.Run(Constants.ConnectionString);

            // Assert
            success.Should().BeFalse();
        }
Beispiel #2
0
        internal static void Main(string[] args)
        {
            Parser.Default
            .ParseArguments <Options>(args)
            .WithParsed(RunWithOptions)
            .WithNotParsed(WriteArgumentErrorMessage);


            void RunWithOptions(Options options)
            {
                bool successful;
                var  message = string.Empty;

                if (options.Uninstall)
                {
                    (successful, message) = Uninstall.Run(options.ConnectionString);
                }
                else
                {
                    (successful, message) = MigrationUtility.Run(options.ConnectionString, options.IncludeIndexes, options.IncludeViews);
                }

                if (!successful)
                {
#if DEBUG
                    System.Console.WriteLine(string.Empty);
                    System.Console.WriteLine(message);
                    System.Console.WriteLine(string.Empty);
                    System.Console.WriteLine("Press any key to continue...");
                    System.Console.ReadKey();
#endif
                    Environment.ExitCode = -2;
                }
                else
                {
                    System.Console.WriteLine("Success!");
                }

                Environment.ExitCode = 0;
            }

            void WriteArgumentErrorMessage(IEnumerable <Error> errors)
            {
                Environment.ExitCode = -1;
            }
        }
 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.Sql(MigrationUtility.ReadSql(typeof(addReservationStored), MigrationUtility.MigrationType.Up));
 }