Guest User

Untitled

a guest
Dec 12th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. --
  2. --
  3. -- If running for ali-staging or ali-production, do:
  4. --
  5. -- DATABASE_MIGRATION_URL="$(heroku run --app ali-production printenv-seo DATABASE_MIGRATION_URL | grep postgres:)"
  6. -- psql $DATABASE_MIGRATION_URL -f db/premigration/release_2018_12_12_y.sql
  7. --
  8. -- If running for development, do:
  9. --
  10. -- DATABASE_MIGRATION_URL=postgres://localhost:9750/crm_dev
  11. -- rake db:migrate:down VERSION=20181130230244
  12. -- rake db:migrate:down VERSION=20181205210738
  13. -- psql $DATABASE_MIGRATION_URL -f db/premigration/release_2018_12_12_w.sql
  14. -- rake db:structure:dump
  15. -- git diff db/structure.sql
  16. --
  17.  
  18. BEGIN;
  19.  
  20. -- Boilerplate: we want all of these things in every premigration.
  21. --
  22. -- Of special importance is citus.multi_shard_commit_protocol. We
  23. -- should never make DDL changes without it.
  24. --
  25. \set ON_ERROR_STOP on
  26. \set ECHO all
  27. SET citus.multi_shard_commit_protocol = '2pc';
  28.  
  29. -- db/migrate/20181205210738_create_record_creation_progress_logs_table.rb
  30. -- create_table :record_creation_progress_logs do |t|
  31. -- t.column :uuid, :uuid
  32. -- t.string :table_name
  33. -- t.datetime :last_record_created_at
  34. -- t.integer :last_record_id, limit: 8
  35. -- t.datetime :last_progressed_at
  36. -- t.integer :last_progressed_id, limit: 8
  37. -- t.timestamps null: false
  38. -- end
  39. --
  40. CREATE TABLE public.record_creation_progress_logs (
  41. id bigserial NOT NULL,
  42. uuid uuid DEFAULT public.gen_random_uuid(),
  43. table_name character varying(255) ,
  44. last_record_created_at timestamp without time zone NOT NULL,
  45. last_record_id bigint,
  46. last_progressed_at timestamp without time zone NOT NULL,
  47. last_progressed_id bigint,
  48. created_at timestamp without time zone NOT NULL,
  49. updated_at timestamp without time zone NOT NULL
  50. );
  51.  
  52. ALTER TABLE ONLY public.record_creation_progress_logs ADD CONSTRAINT record_creation_progress_logs_pkey PRIMARY KEY (id);
  53. CREATE INDEX record_creation_progress_logs_uuid ON public.record_creation_progress_logs USING btree (uuid);
  54.  
  55. \d record_creation_progress_logs
  56.  
  57. COMMIT;
Add Comment
Please, Sign In to add comment