diff --git a/db/migrate/20190921161613_create_relation_transitions.rb b/db/migrate/20190921161613_create_relation_transitions.rb deleted file mode 100644 index aad20c9..0000000 --- a/db/migrate/20190921161613_create_relation_transitions.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -class CreateRelationTransitions < ActiveRecord::Migration[6.0] - include Partynest::Migration - - def change - create_table :relation_transitions do |t| - t.timestamps null: false - - t.references :from_status, - null: true, - foreign_key: { to_table: :relation_statuses } - - t.references :to_status, - null: false, - foreign_key: { to_table: :relation_statuses } - - t.string :name, null: false, index: { unique: true } - - t.index %i[from_status_id to_status_id], unique: true - end - - add_constraint :relation_transitions, :name, <<~SQL - is_good_small_text(name) - SQL - - add_constraint :relation_transitions, :statuses, <<~SQL - from_status_id != to_status_id - SQL - end -end diff --git a/db/migrate/20191001211809_unique_index_statuses_on_relation_transitions.rb b/db/migrate/20191001211809_unique_index_statuses_on_relation_transitions.rb deleted file mode 100644 index bec7f5b..0000000 --- a/db/migrate/20191001211809_unique_index_statuses_on_relation_transitions.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -class UniqueIndexStatusesOnRelationTransitions < ActiveRecord::Migration[6.0] - def change - reversible do |dir| - dir.down do - execute <<~SQL - DROP INDEX - index_relation_transitions_on_to_status_id_when_from_status_id_is_null - SQL - end - - dir.up do - execute <<~SQL - CREATE UNIQUE INDEX - index_relation_transitions_on_to_status_id_when_from_status_id_is_null - ON relation_transitions - USING btree - (to_status_id) - WHERE from_status_id IS NULL; - SQL - end - end - end -end diff --git a/db/migrate/20191002113932_remove_relation_transitions.rb b/db/migrate/20191002113932_remove_relation_transitions.rb deleted file mode 100644 index 79a4c15..0000000 --- a/db/migrate/20191002113932_remove_relation_transitions.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -class RemoveRelationTransitions < ActiveRecord::Migration[6.0] - include Partynest::Migration - - def change - remove_constraint :relation_transitions, :name, <<~SQL - is_good_small_text(name) - SQL - - remove_constraint :relation_transitions, :statuses, <<~SQL - from_status_id != to_status_id - SQL - - reversible do |dir| - dir.up do - execute <<~SQL - DROP INDEX - index_relation_transitions_on_to_status_id_when_from_status_id_is_null - SQL - end - - dir.down do - execute <<~SQL - CREATE UNIQUE INDEX - index_relation_transitions_on_to_status_id_when_from_status_id_is_null - ON relation_transitions - USING btree - (to_status_id) - WHERE from_status_id IS NULL; - SQL - end - end - - drop_table :relation_transitions do |t| - t.timestamps null: false - - t.references :from_status, - null: true, - foreign_key: { to_table: :relation_statuses } - - t.references :to_status, - null: false, - foreign_key: { to_table: :relation_statuses } - - t.string :name, null: false, index: { unique: true } - - t.index %i[from_status_id to_status_id], unique: true - end - end -end diff --git a/db/structure.sql b/db/structure.sql index ee527a9..a92558d 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -1880,7 +1880,6 @@ INSERT INTO "schema_migrations" (version) VALUES ('20181130024918'), ('20190910040709'), ('20190921142404'), -('20190921161613'), ('20190921191213'), ('20190928171705'), ('20190929131544'), @@ -1889,9 +1888,7 @@ INSERT INTO "schema_migrations" (version) VALUES ('20190930210852'), ('20190930215223'), ('20191001022049'), -('20191001211809'), ('20191002002101'), -('20191002113932'), ('20191002170727');