public void Import(MigrationToolOptions settings)
        {
            var sourceImportFilePath = Path.Combine(settings.SourceDirectory, "localization-resource-translations.sql");

            if (!File.Exists(sourceImportFilePath))
            {
                throw new IOException($"Import source file '{sourceImportFilePath}' not found!");
            }

            // create DB structures in target database
            var updater = new SchemaUpdater();

            updater.Execute(new UpdateSchema.Command());

            var fileInfo = new FileInfo(sourceImportFilePath);
            var script   = fileInfo.OpenText().ReadToEnd();

            using (var connection = new SqlConnection(settings.ConnectionString))
            {
                connection.Open();

                using (var command = new SqlCommand(script, connection))
                {
                    command.ExecuteNonQuery();
                }
            }
        }
Example #2
0
 private void InitializeDb(MigrationToolOptions settings)
 {
     try
     {
         var updater = new SchemaUpdater();
         updater.Execute(new UpdateSchema.Command());
     }
     catch
     {
         // it's OK to have exception here
     }
 }