1
0
Fork 0

Remove unnecessary migrations

This commit is contained in:
Alex Kotov 2019-07-20 04:41:09 +05:00
parent 58b10dbdaa
commit 86e44b8c04
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
32 changed files with 3 additions and 371 deletions

View file

@ -1,19 +0,0 @@
# frozen_string_literal: true
class CreateMembershipApplications < ActiveRecord::Migration[5.2]
def change
create_table :membership_applications do |t|
t.timestamps null: false
t.string :first_name, null: false
t.string :last_name, null: false
t.string :middle_name
t.date :date_of_birth, null: false
t.string :occupation
t.string :email, null: false
t.string :phone_number, null: false
t.string :telegram_username
t.text :organization_membership
t.text :comment
end
end
end

View file

@ -1,10 +0,0 @@
# frozen_string_literal: true
class CreateTelegramBots < ActiveRecord::Migration[5.2]
def change
create_table :telegram_bots do |t|
t.timestamps null: false
t.string :secret, null: false
end
end
end

View file

@ -1,7 +0,0 @@
# frozen_string_literal: true
class AddApiTokenToTelegramBots < ActiveRecord::Migration[5.2]
def change
add_column :telegram_bots, :api_token, :string
end
end

View file

@ -1,7 +0,0 @@
# frozen_string_literal: true
class RequireApiTokenOfTelegramBots < ActiveRecord::Migration[5.2]
def change
change_column :telegram_bots, :api_token, :string, null: false
end
end

View file

@ -1,21 +0,0 @@
# frozen_string_literal: true
class CreatePassports < ActiveRecord::Migration[5.2]
def change
create_table :passports do |t|
t.timestamps null: false
t.string :surname, null: false
t.string :given_name, null: false
t.string :patronymic
t.integer :sex, null: false
t.date :date_of_birth, null: false
t.string :place_of_birth, null: false
t.integer :series, null: false
t.integer :number, null: false
t.string :issued_by, null: false
t.string :unit_code, null: false
t.date :date_of_issue, null: false
end
end
end

View file

@ -1,10 +0,0 @@
# frozen_string_literal: true
class ChangeTypeForIssuedByOfPassports < ActiveRecord::Migration[5.2]
def change
change_table :passports, bulk: true do |t|
t.remove :issued_by
t.text :issued_by, null: false
end
end
end

View file

@ -1,13 +0,0 @@
# frozen_string_literal: true
class CreatePassportConfirmations < ActiveRecord::Migration[5.2]
def change
create_table :passport_confirmations do |t|
t.timestamps null: false
t.references :passport, null: false, foreign_key: true
t.references :user, null: false, foreign_key: true
t.index %i[passport_id user_id], unique: true
end
end
end

View file

@ -1,7 +0,0 @@
# frozen_string_literal: true
class AddConfirmedToPassports < ActiveRecord::Migration[5.2]
def change
add_column :passports, :confirmed, :boolean, null: false, default: false
end
end

View file

@ -1,7 +0,0 @@
# frozen_string_literal: true
class AddCountryStateToMembershipApplications < ActiveRecord::Migration[5.2]
def change
add_reference :membership_applications, :country_state, foreign_key: true
end
end

View file

@ -2,15 +2,12 @@
class MoveFromUsersToAccounts < ActiveRecord::Migration[5.2] class MoveFromUsersToAccounts < ActiveRecord::Migration[5.2]
def change def change
remove_foreign_key :passport_confirmations, :users remove_foreign_key :user_roles, :users
remove_foreign_key :user_roles, :users
rename_table :user_roles, :account_roles rename_table :user_roles, :account_roles
rename_column :passport_confirmations, :user_id, :account_id rename_column :account_roles, :user_id, :account_id
rename_column :account_roles, :user_id, :account_id
add_foreign_key :passport_confirmations, :accounts add_foreign_key :account_roles, :accounts
add_foreign_key :account_roles, :accounts
end end
end end

View file

@ -1,9 +0,0 @@
# frozen_string_literal: true
class AddAccountToMembershipApplications < ActiveRecord::Migration[5.2]
def change
add_reference :membership_applications, :account,
null: false, # rubocop:disable Rails/NotNullColumn
foreign_key: true
end
end

View file

@ -1,24 +0,0 @@
# frozen_string_literal: true
class CreatePassportMaps < ActiveRecord::Migration[5.2]
def change
create_table :passport_maps do |t|
t.timestamps null: false
t.references :passport, null: false,
index: { unique: true }, foreign_key: true
t.string :surname, null: false
t.string :given_name, null: false
t.string :patronymic
t.integer :sex, null: false
t.date :date_of_birth, null: false
t.string :place_of_birth, null: false
t.integer :series, null: false
t.integer :number, null: false
t.text :issued_by, null: false
t.string :unit_code, null: false
t.date :date_of_issue, null: false
end
end
end

View file

@ -1,19 +0,0 @@
# frozen_string_literal: true
class RemoveMappingFromPassports < ActiveRecord::Migration[5.2]
def change
change_table :passports, bulk: true do |t|
t.remove :surname
t.remove :given_name
t.remove :patronymic
t.remove :sex
t.remove :date_of_birth
t.remove :place_of_birth
t.remove :series
t.remove :number
t.remove :issued_by
t.remove :unit_code
t.remove :date_of_issue
end
end
end

View file

@ -1,14 +0,0 @@
# frozen_string_literal: true
class NonUniquePassportForPassportMaps < ActiveRecord::Migration[5.2]
def change
remove_reference :passport_maps, :passport,
null: false,
index: { unique: true },
foreign_key: true
add_reference :passport_maps, :passport,
null: false, # rubocop:disable Rails/NotNullColumn
foreign_key: true
end
end

View file

@ -1,10 +0,0 @@
# frozen_string_literal: true
class CreateMembershipPools < ActiveRecord::Migration[5.2]
def change
create_table :membership_pools do |t|
t.timestamps null: false
t.string :name, null: false
end
end
end

View file

@ -1,7 +0,0 @@
# frozen_string_literal: true
class RenameMembershipApplicationsToMembershipApps < ActiveRecord::Migration[5.2] # rubocop:disable Metrics/LineLength
def change
rename_table :membership_applications, :membership_apps
end
end

View file

@ -1,16 +0,0 @@
# frozen_string_literal: true
class CreateMembershipPoolApps < ActiveRecord::Migration[5.2]
def change
create_table :membership_pool_apps do |t|
t.timestamps null: false
t.references :membership_pool, null: false, foreign_key: true
t.references :membership_app, null: false, foreign_key: true
t.index %i[membership_app_id membership_pool_id],
name: 'index_membership_pool_apps_on_app_and_pool',
unique: true
end
end
end

View file

@ -1,16 +0,0 @@
# frozen_string_literal: true
class CreateMembershipPoolAccounts < ActiveRecord::Migration[5.2]
def change
create_table :membership_pool_accounts do |t|
t.timestamps null: false
t.references :membership_pool, null: false, foreign_key: true
t.references :account, null: false, foreign_key: true
t.index %i[membership_pool_id account_id],
name: 'index_membership_pool_accounts_on_pool_and_account',
unique: true
end
end
end

View file

@ -1,9 +0,0 @@
# frozen_string_literal: true
class RemovePools < ActiveRecord::Migration[5.2]
def change
drop_table :membership_pool_apps
drop_table :membership_pool_accounts
drop_table :membership_pools
end
end

View file

@ -1,7 +0,0 @@
# frozen_string_literal: true
class AddUsernameToTelegramBots < ActiveRecord::Migration[5.2]
def change
add_column :telegram_bots, :username, :string, index: true
end
end

View file

@ -1,17 +0,0 @@
# frozen_string_literal: true
class CreateTelegramChats < ActiveRecord::Migration[5.2]
def change
create_table :telegram_chats do |t|
t.timestamps null: false
t.integer :remote_id, null: false, index: { unique: true }
t.string :chat_type, null: false
t.string :title
t.string :username
t.string :first_name
t.string :last_name
end
end
end

View file

@ -1,18 +0,0 @@
# frozen_string_literal: true
class CreateAccountTelegramContacts < ActiveRecord::Migration[5.2]
def change
create_table :account_telegram_contacts do |t|
t.timestamps null: false
t.references :account,
null: false,
foreign_key: true
t.references :telegram_chat,
null: false,
index: { unique: true },
foreign_key: true
end
end
end

View file

@ -1,8 +0,0 @@
# frozen_string_literal: true
class UniqAccountOnMembershipApps < ActiveRecord::Migration[5.2]
def change
remove_index :membership_apps, :account_id
add_index :membership_apps, :account_id, unique: true
end
end

View file

@ -1,7 +0,0 @@
# frozen_string_literal: true
class AddPersonToPassports < ActiveRecord::Migration[6.0]
def change
add_reference :passports, :person, foreign_key: true
end
end

View file

@ -1,9 +0,0 @@
# frozen_string_literal: true
class RemoveUnnecessaryTelegramStuff < ActiveRecord::Migration[6.0]
def change
drop_table :account_telegram_contacts
drop_table :telegram_bots
drop_table :telegram_chats
end
end

View file

@ -1,11 +0,0 @@
# frozen_string_literal: true
class CreateResidentRegistrations < ActiveRecord::Migration[6.0]
def change
create_table :resident_registrations do |t|
t.timestamps null: false
t.references :person, index: true, foreign_key: true
end
end
end

View file

@ -1,9 +0,0 @@
# frozen_string_literal: true
class RenamePeopleNames < ActiveRecord::Migration[6.0]
def change
rename_column :passport_maps, :given_name, :first_name
rename_column :passport_maps, :patronymic, :middle_name
rename_column :passport_maps, :surname, :last_name
end
end

View file

@ -1,7 +0,0 @@
# frozen_string_literal: true
class DropMembershipApps < ActiveRecord::Migration[6.0]
def change
drop_table :membership_apps
end
end

View file

@ -1,8 +0,0 @@
# frozen_string_literal: true
class RemovePassportConfirmations < ActiveRecord::Migration[6.0]
def change
drop_table :passport_confirmations
remove_column :passports, :confirmed
end
end

View file

@ -2,9 +2,6 @@
class TurnPassportMapsIntoPassports < ActiveRecord::Migration[6.0] class TurnPassportMapsIntoPassports < ActiveRecord::Migration[6.0]
def change def change
drop_table :passport_maps
drop_table :passports
create_table :passports do |t| create_table :passports do |t|
t.timestamps null: false t.timestamps null: false

View file

@ -1,7 +0,0 @@
# frozen_string_literal: true
class DropResidentRegistrations < ActiveRecord::Migration[6.0]
def change
drop_table :resident_registrations
end
end

View file

@ -1094,49 +1094,26 @@ ALTER TABLE ONLY public.relationships
SET search_path TO "$user", public; SET search_path TO "$user", public;
INSERT INTO "schema_migrations" (version) VALUES INSERT INTO "schema_migrations" (version) VALUES
('20181126132402'),
('20181129131751'),
('20181129140421'),
('20181129141112'),
('20181129203927'), ('20181129203927'),
('20181129231814'), ('20181129231814'),
('20181130010029'),
('20181130024918'), ('20181130024918'),
('20181130040846'),
('20181130075817'),
('20181130090126'),
('20181130161628'), ('20181130161628'),
('20181130163121'), ('20181130163121'),
('20181201184444'),
('20181202020031'), ('20181202020031'),
('20181202021854'), ('20181202021854'),
('20181202022901'), ('20181202022901'),
('20181202104848'),
('20181202140310'),
('20181202142918'),
('20181202201924'),
('20181204024403'), ('20181204024403'),
('20181204030126'), ('20181204030126'),
('20181204030414'), ('20181204030414'),
('20181206014718'), ('20181206014718'),
('20181206190602'),
('20181206193802'),
('20181206194527'),
('20181206205529'),
('20181206223335'),
('20181206224446'), ('20181206224446'),
('20181207002553'),
('20181207030332'),
('20181210024922'), ('20181210024922'),
('20181210033105'), ('20181210033105'),
('20181210033307'), ('20181210033307'),
('20181212000903'),
('20181213053336'),
('20181215040559'), ('20181215040559'),
('20181215053720'), ('20181215053720'),
('20190129013754'), ('20190129013754'),
('20190129015721'), ('20190129015721'),
('20190131025820'),
('20190201002444'), ('20190201002444'),
('20190201012021'), ('20190201012021'),
('20190201013649'), ('20190201013649'),
@ -1144,17 +1121,13 @@ INSERT INTO "schema_migrations" (version) VALUES
('20190201214347'), ('20190201214347'),
('20190202041009'), ('20190202041009'),
('20190208062215'), ('20190208062215'),
('20190324172539'),
('20190324192022'), ('20190324192022'),
('20190324204513'), ('20190324204513'),
('20190324210722'), ('20190324210722'),
('20190324211036'), ('20190324211036'),
('20190325230751'),
('20190326004506'), ('20190326004506'),
('20190326200244'), ('20190326200244'),
('20190326201603'),
('20190427141639'), ('20190427141639'),
('20190503074518'),
('20190605011616'), ('20190605011616'),
('20190605012813'), ('20190605012813'),
('20190605022109'), ('20190605022109'),
@ -1164,9 +1137,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20190627000456'), ('20190627000456'),
('20190708130309'), ('20190708130309'),
('20190715210610'), ('20190715210610'),
('20190718181335'),
('20190718184543'), ('20190718184543'),
('20190719024630'),
('20190719224405'); ('20190719224405');