Пример #1
0
        public void Execute()
        {
            var dir = App.BaseMigrationsDirectory + @"\" + _args.Name;

            if (_ds.Exists(dir))
            {
                throw new GatorException("Warning -- A migration with that name already exists - exiting");
            }

            _ds.Create(dir);

            var cfg = new MigrationConfig {
                created = DateTime.Now, versionNumber = "0.0.0"
            };

            _fs.CreateWithContent(dir + "/version.json", JsonConvert.SerializeObject(cfg));
        }
Пример #2
0
        public void Execute()
        {
            if (_fs.Exists(App.DbJsonCfgFile))
            {
                throw new GatorException("Warning -- Application already exists at this location");
            }

            var cfg = new DbConfig {
                type = "unspecified", connectionString = "", currentVersion = "0.0.0", lastMigration = "none"
            };

            _fs.CreateWithContent(App.DbJsonCfgFile, JsonConvert.SerializeObject(cfg, Formatting.Indented, new IsoDateTimeConverter()));

            _ds.Create(App.BaseMigrationsDirectory);

            Console.WriteLine("Database config file and versions directory created.");
        }