From 766ddd6d958826049c2811f6d058480246e423a6 Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Wed, 1 Mar 2017 17:59:33 -0500 Subject: [PATCH] 11168: Prohibit down-migration to YAML-only codebase. --- .../20170301225558_no_downgrade_after_json.rb | 9 ++ services/api/db/structure.sql | 134 +++++++++--------- 2 files changed, 77 insertions(+), 66 deletions(-) create mode 100644 services/api/db/migrate/20170301225558_no_downgrade_after_json.rb diff --git a/services/api/db/migrate/20170301225558_no_downgrade_after_json.rb b/services/api/db/migrate/20170301225558_no_downgrade_after_json.rb new file mode 100644 index 0000000000..030085ef08 --- /dev/null +++ b/services/api/db/migrate/20170301225558_no_downgrade_after_json.rb @@ -0,0 +1,9 @@ +class NoDowngradeAfterJson < ActiveRecord::Migration + def up + end + + def down + raise ActiveRecord::IrreversibleMigration. + new("cannot downgrade: older versions cannot read JSON from DB tables") + end +end diff --git a/services/api/db/structure.sql b/services/api/db/structure.sql index 9e1f0c9c29..87b657543b 100644 --- a/services/api/db/structure.sql +++ b/services/api/db/structure.sql @@ -28,71 +28,6 @@ SET default_tablespace = ''; SET default_with_oids = false; --- --- Name: groups; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE groups ( - id integer NOT NULL, - uuid character varying(255), - owner_uuid character varying(255), - created_at timestamp without time zone NOT NULL, - modified_by_client_uuid character varying(255), - modified_by_user_uuid character varying(255), - modified_at timestamp without time zone, - name character varying(255) NOT NULL, - description character varying(524288), - updated_at timestamp without time zone NOT NULL, - group_class character varying(255) -); - - --- --- Name: links; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE links ( - id integer NOT NULL, - uuid character varying(255), - owner_uuid character varying(255), - created_at timestamp without time zone NOT NULL, - modified_by_client_uuid character varying(255), - modified_by_user_uuid character varying(255), - modified_at timestamp without time zone, - tail_uuid character varying(255), - link_class character varying(255), - name character varying(255), - head_uuid character varying(255), - properties text, - updated_at timestamp without time zone NOT NULL -); - - --- --- Name: users; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE users ( - id integer NOT NULL, - uuid character varying(255), - owner_uuid character varying(255) NOT NULL, - created_at timestamp without time zone NOT NULL, - modified_by_client_uuid character varying(255), - modified_by_user_uuid character varying(255), - modified_at timestamp without time zone, - email character varying(255), - first_name character varying(255), - last_name character varying(255), - identity_url character varying(255), - is_admin boolean, - prefs text, - updated_at timestamp without time zone NOT NULL, - default_owner_uuid character varying(255), - is_active boolean DEFAULT false, - username character varying(255) -); - - -- -- Name: api_client_authorizations; Type: TABLE; Schema: public; Owner: -; Tablespace: -- @@ -438,6 +373,25 @@ CREATE SEQUENCE containers_id_seq ALTER SEQUENCE containers_id_seq OWNED BY containers.id; +-- +-- Name: groups; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE groups ( + id integer NOT NULL, + uuid character varying(255), + owner_uuid character varying(255), + created_at timestamp without time zone NOT NULL, + modified_by_client_uuid character varying(255), + modified_by_user_uuid character varying(255), + modified_at timestamp without time zone, + name character varying(255) NOT NULL, + description character varying(524288), + updated_at timestamp without time zone NOT NULL, + group_class character varying(255) +); + + -- -- Name: groups_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- @@ -704,6 +658,27 @@ CREATE SEQUENCE keep_services_id_seq ALTER SEQUENCE keep_services_id_seq OWNED BY keep_services.id; +-- +-- Name: links; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE links ( + id integer NOT NULL, + uuid character varying(255), + owner_uuid character varying(255), + created_at timestamp without time zone NOT NULL, + modified_by_client_uuid character varying(255), + modified_by_user_uuid character varying(255), + modified_at timestamp without time zone, + tail_uuid character varying(255), + link_class character varying(255), + name character varying(255), + head_uuid character varying(255), + properties text, + updated_at timestamp without time zone NOT NULL +); + + -- -- Name: links_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- @@ -1009,6 +984,31 @@ CREATE SEQUENCE traits_id_seq ALTER SEQUENCE traits_id_seq OWNED BY traits.id; +-- +-- Name: users; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE users ( + id integer NOT NULL, + uuid character varying(255), + owner_uuid character varying(255) NOT NULL, + created_at timestamp without time zone NOT NULL, + modified_by_client_uuid character varying(255), + modified_by_user_uuid character varying(255), + modified_at timestamp without time zone, + email character varying(255), + first_name character varying(255), + last_name character varying(255), + identity_url character varying(255), + is_admin boolean, + prefs text, + updated_at timestamp without time zone NOT NULL, + default_owner_uuid character varying(255), + is_active boolean DEFAULT false, + username character varying(255) +); + + -- -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- @@ -2742,4 +2742,6 @@ INSERT INTO schema_migrations (version) VALUES ('20170105160301'); INSERT INTO schema_migrations (version) VALUES ('20170105160302'); -INSERT INTO schema_migrations (version) VALUES ('20170216170823'); \ No newline at end of file +INSERT INTO schema_migrations (version) VALUES ('20170216170823'); + +INSERT INTO schema_migrations (version) VALUES ('20170301225558'); \ No newline at end of file -- 2.30.2