From d5379311cb7d62b8375e505a96115e4a358b684d Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Mon, 4 Jun 2018 13:57:49 -0500 Subject: [PATCH] Closes #60 --- ...=> 20180214124311_create_source_tokens.rb} | 0 ...0180215124311_add_card_token_to_ticket.rb} | 0 ...6124311_change_ddd_supporter_to_holder.rb} | 0 ...s.rb => 20180217124311_remove_articles.rb} | 0 db/structure.sql | 10 ++++---- spec/migration/migration_sanity_spec.rb | 24 +++++++++++++++++++ 6 files changed, 29 insertions(+), 5 deletions(-) rename db/migrate/{201810202124312_create_source_tokens.rb => 20180214124311_create_source_tokens.rb} (100%) rename db/migrate/{201810202124313_add_card_token_to_ticket.rb => 20180215124311_add_card_token_to_ticket.rb} (100%) rename db/migrate/{201810202124314_change_ddd_supporter_to_holder.rb => 20180216124311_change_ddd_supporter_to_holder.rb} (100%) rename db/migrate/{201810202124315_remove_articles.rb => 20180217124311_remove_articles.rb} (100%) create mode 100644 spec/migration/migration_sanity_spec.rb diff --git a/db/migrate/201810202124312_create_source_tokens.rb b/db/migrate/20180214124311_create_source_tokens.rb similarity index 100% rename from db/migrate/201810202124312_create_source_tokens.rb rename to db/migrate/20180214124311_create_source_tokens.rb diff --git a/db/migrate/201810202124313_add_card_token_to_ticket.rb b/db/migrate/20180215124311_add_card_token_to_ticket.rb similarity index 100% rename from db/migrate/201810202124313_add_card_token_to_ticket.rb rename to db/migrate/20180215124311_add_card_token_to_ticket.rb diff --git a/db/migrate/201810202124314_change_ddd_supporter_to_holder.rb b/db/migrate/20180216124311_change_ddd_supporter_to_holder.rb similarity index 100% rename from db/migrate/201810202124314_change_ddd_supporter_to_holder.rb rename to db/migrate/20180216124311_change_ddd_supporter_to_holder.rb diff --git a/db/migrate/201810202124315_remove_articles.rb b/db/migrate/20180217124311_remove_articles.rb similarity index 100% rename from db/migrate/201810202124315_remove_articles.rb rename to db/migrate/20180217124311_remove_articles.rb diff --git a/db/structure.sql b/db/structure.sql index 1421a7d6..32c6f363 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -3,7 +3,7 @@ -- -- Dumped from database version 9.6.5 --- Dumped by pg_dump version 9.6.8 +-- Dumped by pg_dump version 9.6.9 SET statement_timeout = 0; SET lock_timeout = 0; @@ -4258,11 +4258,11 @@ INSERT INTO schema_migrations (version) VALUES ('20180202181929'); INSERT INTO schema_migrations (version) VALUES ('20180213191755'); -INSERT INTO schema_migrations (version) VALUES ('201810202124312'); +INSERT INTO schema_migrations (version) VALUES ('20180214124311'); -INSERT INTO schema_migrations (version) VALUES ('201810202124313'); +INSERT INTO schema_migrations (version) VALUES ('20180215124311'); -INSERT INTO schema_migrations (version) VALUES ('201810202124314'); +INSERT INTO schema_migrations (version) VALUES ('20180216124311'); -INSERT INTO schema_migrations (version) VALUES ('201810202124315'); +INSERT INTO schema_migrations (version) VALUES ('20180217124311'); diff --git a/spec/migration/migration_sanity_spec.rb b/spec/migration/migration_sanity_spec.rb new file mode 100644 index 00000000..8aac25b4 --- /dev/null +++ b/spec/migration/migration_sanity_spec.rb @@ -0,0 +1,24 @@ +# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later +require 'rails_helper' + +describe 'Migration sanity' do + + it 'Migrations have a sane timestamp' do + Dir.open(File.join(Rails.root, 'db', 'migrate')) do |dir| + #should be a hash but we don't have in Ruby 2.3 + migration_names = [] + + dir.entries.each do |file| + if file != '.' && file != '..' + ret = file.split('_', 2) + expect(ret[0].length).to eq 14 + expect{ Integer(ret[0])}.to_not raise_error + expect(migration_names).to_not include ret[1] + + migration_names.push(ret[1]) + end + end + + end + end +end \ No newline at end of file