Sha256: 125c4d3702004ee80662bd9409817f6c33cd2af9611e5ceff48d6de1e0c2d3d0
Contents?: true
Size: 1.33 KB
Versions: 38
Compression:
Stored size: 1.33 KB
Contents
require "spec_helper" describe DataMigrate::LegacyMigrator do let(:context) { DataMigrate::MigrationContext.new("spec/db/data") } after do begin ActiveRecord::Migration.drop_table("data_migrations") ActiveRecord::Migration.drop_table("schema_migrations") rescue StandardError nil end end before do ActiveRecord::Base.establish_connection(db_config) ActiveRecord::SchemaMigration.create_table DataMigrate::DataSchemaMigration.create_table end let(:db_config) do { adapter: "sqlite3", database: "spec/db/test.db" } end it "migrate legacy migrations to be in correct table" do DataMigrate::DataSchemaMigration.create_table # simulate creation of legacy data migration when # it was recorded in schema table ActiveRecord::SchemaMigration.create(version: "20091231235959") # create one migration in correct place DataMigrate::DataSchemaMigration.create(version: "20171231235959") migrated = DataMigrate::DataMigrator .new(:up, []).load_migrated expect(migrated.count).to eq 1 DataMigrate::LegacyMigrator.new("spec/db/data").migrate # after migacy migrator has been run, we should have records # of both migrations migrated = DataMigrate::DataMigrator .new(:up, []).load_migrated expect(migrated.count).to eq 2 end end
Version data entries
38 entries across 38 versions & 1 rubygems