-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding a unique index to migrations (#815)
* Adding an index to migrations with a unique constraint to avoid duplicate versions. Fixes #814 * Using the test db for this spec since the sample db seems to fail in CI
- Loading branch information
Showing
2 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require "../../spec_helper" | ||
|
||
describe Avram::Migrator::Runner do | ||
describe "setup_migration_tracking_table" do | ||
it "includes a unique index" do | ||
Avram.temp_config(database_to_migrate: TestDatabase) do | ||
Avram::Migrator::Runner.setup_migration_tracking_tables | ||
|
||
results = TestDatabase.query_all("SELECT indexname FROM pg_catalog.pg_indexes WHERE tablename = 'migrations'", as: String) | ||
results.should contain("migrations_version_index") | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters