From df3c19af805ab98eac8fbde29bb0146eb5add8c2 Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Mon, 22 Jul 2019 07:38:23 +0500 Subject: [PATCH] Merge migrations --- config/locales/activerecord/en.yml | 2 +- config/locales/activerecord/ru.yml | 2 +- .../20181129203927_devise_create_users.rb | 1 + .../20190201002444_add_username_to_accounts.rb | 7 ------- ...0190201012021_unique_username_of_accounts.rb | 17 ----------------- ...2022_rename_accounts_username_to_nickname.rb | 7 ------- db/structure.sql | 12 ++++++++---- 7 files changed, 11 insertions(+), 37 deletions(-) delete mode 100644 db/migrate/20190201002444_add_username_to_accounts.rb delete mode 100644 db/migrate/20190201012021_unique_username_of_accounts.rb delete mode 100644 db/migrate/20190324192022_rename_accounts_username_to_nickname.rb diff --git a/config/locales/activerecord/en.yml b/config/locales/activerecord/en.yml index 08d891f..642bffc 100644 --- a/config/locales/activerecord/en.yml +++ b/config/locales/activerecord/en.yml @@ -25,7 +25,7 @@ en: attributes: account: id: ID - username: Username + nickname: Username public_name: Public name biography: Bio avatar: Avatar diff --git a/config/locales/activerecord/ru.yml b/config/locales/activerecord/ru.yml index 08733cf..2b52433 100644 --- a/config/locales/activerecord/ru.yml +++ b/config/locales/activerecord/ru.yml @@ -25,7 +25,7 @@ ru: attributes: account: id: ID - username: Имя пользователя + nickname: Имя пользователя public_name: Публичное имя biography: Биография avatar: Аватар diff --git a/db/migrate/20181129203927_devise_create_users.rb b/db/migrate/20181129203927_devise_create_users.rb index aa00c46..c113208 100644 --- a/db/migrate/20181129203927_devise_create_users.rb +++ b/db/migrate/20181129203927_devise_create_users.rb @@ -22,6 +22,7 @@ class DeviseCreateUsers < ActiveRecord::Migration[5.2] t.timestamps null: false t.string :guest_token, null: false, index: { unique: true } + t.string :nickname, null: false, index: { unique: true } t.references :person, index: { unique: true } end diff --git a/db/migrate/20190201002444_add_username_to_accounts.rb b/db/migrate/20190201002444_add_username_to_accounts.rb deleted file mode 100644 index 0e919c1..0000000 --- a/db/migrate/20190201002444_add_username_to_accounts.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -class AddUsernameToAccounts < ActiveRecord::Migration[6.0] - def change - add_column :accounts, :username, :string, index: { unique: true } - end -end diff --git a/db/migrate/20190201012021_unique_username_of_accounts.rb b/db/migrate/20190201012021_unique_username_of_accounts.rb deleted file mode 100644 index 2b93e97..0000000 --- a/db/migrate/20190201012021_unique_username_of_accounts.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -class UniqueUsernameOfAccounts < ActiveRecord::Migration[6.0] - def change - reversible do |dir| - dir.up do - change_column :accounts, :username, :string, null: false, - index: { unique: true } - end - - dir.down do - change_column :accounts, :username, :string, null: false, - index: { unique: false } - end - end - end -end diff --git a/db/migrate/20190324192022_rename_accounts_username_to_nickname.rb b/db/migrate/20190324192022_rename_accounts_username_to_nickname.rb deleted file mode 100644 index a7bde27..0000000 --- a/db/migrate/20190324192022_rename_accounts_username_to_nickname.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -class RenameAccountsUsernameToNickname < ActiveRecord::Migration[6.0] - def change - rename_column :accounts, :username, :nickname - end -end diff --git a/db/structure.sql b/db/structure.sql index ae6bd0e..987c22d 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -101,8 +101,8 @@ CREATE TABLE public.accounts ( created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL, guest_token character varying NOT NULL, - person_id bigint, nickname character varying NOT NULL, + person_id bigint, biography text, public_name character varying, contacts_list_id bigint NOT NULL, @@ -838,6 +838,13 @@ CREATE UNIQUE INDEX index_accounts_on_contacts_list_id ON public.accounts USING CREATE UNIQUE INDEX index_accounts_on_guest_token ON public.accounts USING btree (guest_token); +-- +-- Name: index_accounts_on_nickname; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX index_accounts_on_nickname ON public.accounts USING btree (nickname); + + -- -- Name: index_accounts_on_person_id; Type: INDEX; Schema: public; Owner: - -- @@ -1133,13 +1140,10 @@ SET search_path TO "$user", public; INSERT INTO "schema_migrations" (version) VALUES ('20181129203927'), ('20181130024918'), -('20190201002444'), -('20190201012021'), ('20190201035804'), ('20190201214347'), ('20190202041009'), ('20190208062215'), -('20190324192022'), ('20190324204513'), ('20190324210722'), ('20190324211036'),