From 4b977dc195d529078bf814e50a7ccda842c20cdd Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Tue, 12 Jun 2018 07:25:39 +0300 Subject: [PATCH 1/3] Enable "pgcrypto" postgres engine --- db/migrate/20180612042234_enable_pgcrypto_ext.rb | 5 +++++ db/structure.sql | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 db/migrate/20180612042234_enable_pgcrypto_ext.rb diff --git a/db/migrate/20180612042234_enable_pgcrypto_ext.rb b/db/migrate/20180612042234_enable_pgcrypto_ext.rb new file mode 100644 index 000000000..4e8df65bf --- /dev/null +++ b/db/migrate/20180612042234_enable_pgcrypto_ext.rb @@ -0,0 +1,5 @@ +class EnablePgcryptoExt < ActiveRecord::Migration + def change + enable_extension 'pgcrypto' + end +end diff --git a/db/structure.sql b/db/structure.sql index 744ea9e19..de3c10c61 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -51,6 +51,20 @@ CREATE EXTENSION IF NOT EXISTS hstore WITH SCHEMA public; COMMENT ON EXTENSION hstore IS 'data type for storing sets of (key, value) pairs'; +-- +-- Name: pgcrypto; Type: EXTENSION; Schema: -; Owner: - +-- + +CREATE EXTENSION IF NOT EXISTS pgcrypto WITH SCHEMA public; + + +-- +-- Name: EXTENSION pgcrypto; Type: COMMENT; Schema: -; Owner: - +-- + +COMMENT ON EXTENSION pgcrypto IS 'cryptographic functions'; + + SET search_path = public, pg_catalog; -- @@ -4716,3 +4730,5 @@ INSERT INTO schema_migrations (version) VALUES ('20180327151906'); INSERT INTO schema_migrations (version) VALUES ('20180331200125'); +INSERT INTO schema_migrations (version) VALUES ('20180612042234'); + From 981c5642148c980aaee4ca6273e4a3abd548e016 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Tue, 12 Jun 2018 07:29:47 +0300 Subject: [PATCH 2/3] Add `contacts.uuid` DB column --- db/migrate/20180612042625_add_uuid_to_contacts.rb | 5 +++++ db/structure.sql | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20180612042625_add_uuid_to_contacts.rb diff --git a/db/migrate/20180612042625_add_uuid_to_contacts.rb b/db/migrate/20180612042625_add_uuid_to_contacts.rb new file mode 100644 index 000000000..c80d60e71 --- /dev/null +++ b/db/migrate/20180612042625_add_uuid_to_contacts.rb @@ -0,0 +1,5 @@ +class AddUuidToContacts < ActiveRecord::Migration + def change + add_column :contacts, :uuid, :uuid, default: 'gen_random_uuid()' + end +end diff --git a/db/structure.sql b/db/structure.sql index de3c10c61..1332bccfb 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -639,7 +639,8 @@ CREATE TABLE contacts ( original_id integer, ident_updated_at timestamp without time zone, upid integer, - up_date timestamp without time zone + up_date timestamp without time zone, + uuid uuid DEFAULT gen_random_uuid() ); @@ -4732,3 +4733,5 @@ INSERT INTO schema_migrations (version) VALUES ('20180331200125'); INSERT INTO schema_migrations (version) VALUES ('20180612042234'); +INSERT INTO schema_migrations (version) VALUES ('20180612042625'); + From 1eca44f32c0fcb175d446cedcae3e86a4873789c Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Tue, 12 Jun 2018 07:34:40 +0300 Subject: [PATCH 3/3] Add `domains.uuid` DB column --- db/migrate/20180612042953_add_uuid_to_domains.rb | 5 +++++ db/structure.sql | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20180612042953_add_uuid_to_domains.rb diff --git a/db/migrate/20180612042953_add_uuid_to_domains.rb b/db/migrate/20180612042953_add_uuid_to_domains.rb new file mode 100644 index 000000000..6ca609de3 --- /dev/null +++ b/db/migrate/20180612042953_add_uuid_to_domains.rb @@ -0,0 +1,5 @@ +class AddUuidToDomains < ActiveRecord::Migration + def change + add_column :domains, :uuid, :uuid, default: 'gen_random_uuid()' + end +end diff --git a/db/structure.sql b/db/structure.sql index 1332bccfb..cf2f858b4 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -912,7 +912,8 @@ CREATE TABLE domains ( status_notes hstore, statuses_backup character varying[] DEFAULT '{}'::character varying[], upid integer, - up_date timestamp without time zone + up_date timestamp without time zone, + uuid uuid DEFAULT gen_random_uuid() ); @@ -4735,3 +4736,5 @@ INSERT INTO schema_migrations (version) VALUES ('20180612042234'); INSERT INTO schema_migrations (version) VALUES ('20180612042625'); +INSERT INTO schema_migrations (version) VALUES ('20180612042953'); +