spec/dummy/log/development.log in kithe-2.0.1 vs spec/dummy/log/development.log in kithe-2.0.2
- old
+ new
@@ -111538,5 +111538,751 @@
[1m[36mActiveRecord::InternalMetadata Load (0.3ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", "schema_sha1"], ["LIMIT", 1]]
[1m[35m (0.2ms)[0m [1m[35mBEGIN[0m
[1m[36mActiveRecord::InternalMetadata Create (0.3ms)[0m [1m[32mINSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key"[0m [["key", "schema_sha1"], ["value", "0e24e2caa948e64f3be11233d707b8abffa0f356"], ["created_at", "2020-05-28 13:26:55.668516"], ["updated_at", "2020-05-28 13:26:55.668516"]]
[1m[35m (0.5ms)[0m [1m[35mCOMMIT[0m
[1m[35m (1.0ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
+ [1m[35m (2.9ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
+ [1m[35m (0.6ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
+ [1m[35m (0.3ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
+ [1m[35m (0.3ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
+ [1m[35m (0.3ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
+ [1m[35m (0.2ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
+ [1m[35m (1.0ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
+ [1m[35m (0.6ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
+ [1m[35m (0.5ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
+ [1m[35m (0.3ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
+ [1m[35m (0.4ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
+ [1m[35m (0.3ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
+ [1m[35mSQL (38.3ms)[0m [1m[35mCREATE EXTENSION IF NOT EXISTS "pgcrypto"[0m
+ [1m[35mSQL (0.3ms)[0m [1m[35mCREATE EXTENSION IF NOT EXISTS "plpgsql"[0m
+ [1m[35m (32.7ms)[0m [1m[35mCREATE OR REPLACE FUNCTION public.kithe_models_friendlier_id_gen(min_value bigint, max_value bigint)
+ RETURNS text
+ LANGUAGE plpgsql
+AS $function$
+ DECLARE
+ new_id_int bigint;
+ new_id_str character varying := '';
+ done bool;
+ tries integer;
+ alphabet char[] := ARRAY['0','1','2','3','4','5','6','7','8','9',
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
+ 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
+ alphabet_length integer := array_length(alphabet, 1);
+
+ BEGIN
+ done := false;
+ tries := 0;
+ WHILE (NOT done) LOOP
+ tries := tries + 1;
+ IF (tries > 3) THEN
+ RAISE 'Could not find non-conflicting friendlier_id in 3 tries';
+ END IF;
+
+ new_id_int := trunc(random() * (max_value - min_value) + min_value);
+
+ -- convert bigint to a Base-36 alphanumeric string
+ -- see https://web.archive.org/web/20130420084605/http://www.jamiebegin.com/base36-conversion-in-postgresql/
+ -- https://gist.github.com/btbytes/7159902
+ WHILE new_id_int != 0 LOOP
+ new_id_str := alphabet[(new_id_int % alphabet_length)+1] || new_id_str;
+ new_id_int := new_id_int / alphabet_length;
+ END LOOP;
+
+ done := NOT exists(SELECT 1 FROM kithe_models WHERE friendlier_id=new_id_str);
+ END LOOP;
+ RETURN new_id_str;
+ END;
+ $function$
+[0m
+ [1m[35m (45.1ms)[0m [1m[35mDROP TABLE IF EXISTS "kithe_derivatives" CASCADE[0m
+ [1m[35m (50.4ms)[0m [1m[35mCREATE TABLE "kithe_derivatives" ("id" bigserial primary key, "key" character varying NOT NULL, "file_data" jsonb, "asset_id" uuid NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)[0m
+ [1m[35m (1.8ms)[0m [1m[35mCREATE UNIQUE INDEX "index_kithe_derivatives_on_asset_id_and_key" ON "kithe_derivatives" ("asset_id", "key")[0m
+ [1m[35m (1.5ms)[0m [1m[35mCREATE INDEX "index_kithe_derivatives_on_asset_id" ON "kithe_derivatives" ("asset_id")[0m
+ [1m[35m (3.6ms)[0m [1m[35mDROP TABLE IF EXISTS "kithe_model_contains" CASCADE[0m
+ [1m[35m (4.5ms)[0m [1m[35mCREATE TABLE "kithe_model_contains" ("containee_id" uuid, "container_id" uuid)[0m
+ [1m[35m (2.0ms)[0m [1m[35mCREATE INDEX "index_kithe_model_contains_on_containee_id" ON "kithe_model_contains" ("containee_id")[0m
+ [1m[35m (1.7ms)[0m [1m[35mCREATE INDEX "index_kithe_model_contains_on_container_id" ON "kithe_model_contains" ("container_id")[0m
+ [1m[35m (7.3ms)[0m [1m[35mDROP TABLE IF EXISTS "kithe_models" CASCADE[0m
+ [1m[35m (12.2ms)[0m [1m[35mCREATE TABLE "kithe_models" ("id" uuid DEFAULT gen_random_uuid() NOT NULL PRIMARY KEY, "title" character varying NOT NULL, "type" character varying NOT NULL, "position" integer, "json_attributes" jsonb, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "parent_id" uuid, "friendlier_id" character varying DEFAULT kithe_models_friendlier_id_gen('2821109907456'::bigint, '101559956668415'::bigint) NOT NULL, "file_data" jsonb, "representative_id" uuid, "leaf_representative_id" uuid, "kithe_model_type" integer NOT NULL)[0m
+ [1m[35m (1.3ms)[0m [1m[35mCREATE UNIQUE INDEX "index_kithe_models_on_friendlier_id" ON "kithe_models" ("friendlier_id")[0m
+ [1m[35m (1.8ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_leaf_representative_id" ON "kithe_models" ("leaf_representative_id")[0m
+ [1m[35m (1.3ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_parent_id" ON "kithe_models" ("parent_id")[0m
+ [1m[35m (1.2ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_representative_id" ON "kithe_models" ("representative_id")[0m
+ [1m[35m (8.9ms)[0m [1m[35mCREATE TABLE "plain_old_ar" ("id" bigserial primary key, "title" character varying, "description" text)[0m
+ [1m[35m (6.3ms)[0m [1m[35mALTER TABLE "kithe_derivatives" ADD CONSTRAINT "fk_rails_3dac8b4201"
+FOREIGN KEY ("asset_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (3.9ms)[0m [1m[35mALTER TABLE "kithe_model_contains" ADD CONSTRAINT "fk_rails_490c1158f7"
+FOREIGN KEY ("containee_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (2.8ms)[0m [1m[35mALTER TABLE "kithe_model_contains" ADD CONSTRAINT "fk_rails_091010187b"
+FOREIGN KEY ("container_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (1.8ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_403cce5c0d"
+FOREIGN KEY ("leaf_representative_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (3.4ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_90130a9780"
+FOREIGN KEY ("parent_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (1.9ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_afa93b7b5d"
+FOREIGN KEY ("representative_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (0.8ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
+ [1m[36mActiveRecord::InternalMetadata Load (0.4ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", "environment"], ["LIMIT", 1]]
+ [1m[36mActiveRecord::InternalMetadata Load (0.3ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", "environment"], ["LIMIT", 1]]
+ [1m[36mActiveRecord::InternalMetadata Load (0.3ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", "schema_sha1"], ["LIMIT", 1]]
+ [1m[35m (0.2ms)[0m [1m[35mBEGIN[0m
+ [1m[36mActiveRecord::InternalMetadata Update (0.5ms)[0m [1m[33mUPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3[0m [["value", "03c1babae3d781ef770d42f3017561a4fadf7200"], ["updated_at", "2020-06-04 16:46:18.145376"], ["key", "schema_sha1"]]
+ [1m[35m (0.4ms)[0m [1m[35mCOMMIT[0m
+ [1m[35mSQL (2.6ms)[0m [1m[35mCREATE EXTENSION IF NOT EXISTS "pgcrypto"[0m
+ [1m[35mSQL (0.5ms)[0m [1m[35mCREATE EXTENSION IF NOT EXISTS "plpgsql"[0m
+ [1m[35m (28.9ms)[0m [1m[35mCREATE OR REPLACE FUNCTION public.kithe_models_friendlier_id_gen(min_value bigint, max_value bigint)
+ RETURNS text
+ LANGUAGE plpgsql
+AS $function$
+ DECLARE
+ new_id_int bigint;
+ new_id_str character varying := '';
+ done bool;
+ tries integer;
+ alphabet char[] := ARRAY['0','1','2','3','4','5','6','7','8','9',
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
+ 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
+ alphabet_length integer := array_length(alphabet, 1);
+
+ BEGIN
+ done := false;
+ tries := 0;
+ WHILE (NOT done) LOOP
+ tries := tries + 1;
+ IF (tries > 3) THEN
+ RAISE 'Could not find non-conflicting friendlier_id in 3 tries';
+ END IF;
+
+ new_id_int := trunc(random() * (max_value - min_value) + min_value);
+
+ -- convert bigint to a Base-36 alphanumeric string
+ -- see https://web.archive.org/web/20130420084605/http://www.jamiebegin.com/base36-conversion-in-postgresql/
+ -- https://gist.github.com/btbytes/7159902
+ WHILE new_id_int != 0 LOOP
+ new_id_str := alphabet[(new_id_int % alphabet_length)+1] || new_id_str;
+ new_id_int := new_id_int / alphabet_length;
+ END LOOP;
+
+ done := NOT exists(SELECT 1 FROM kithe_models WHERE friendlier_id=new_id_str);
+ END LOOP;
+ RETURN new_id_str;
+ END;
+ $function$
+[0m
+ [1m[35m (29.1ms)[0m [1m[35mDROP TABLE IF EXISTS "kithe_derivatives" CASCADE[0m
+ [1m[35m (24.3ms)[0m [1m[35mCREATE TABLE "kithe_derivatives" ("id" bigserial primary key, "key" character varying NOT NULL, "file_data" jsonb, "asset_id" uuid NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)[0m
+ [1m[35m (2.2ms)[0m [1m[35mCREATE UNIQUE INDEX "index_kithe_derivatives_on_asset_id_and_key" ON "kithe_derivatives" ("asset_id", "key")[0m
+ [1m[35m (1.3ms)[0m [1m[35mCREATE INDEX "index_kithe_derivatives_on_asset_id" ON "kithe_derivatives" ("asset_id")[0m
+ [1m[35m (2.7ms)[0m [1m[35mDROP TABLE IF EXISTS "kithe_model_contains" CASCADE[0m
+ [1m[35m (1.3ms)[0m [1m[35mCREATE TABLE "kithe_model_contains" ("containee_id" uuid, "container_id" uuid)[0m
+ [1m[35m (1.3ms)[0m [1m[35mCREATE INDEX "index_kithe_model_contains_on_containee_id" ON "kithe_model_contains" ("containee_id")[0m
+ [1m[35m (1.3ms)[0m [1m[35mCREATE INDEX "index_kithe_model_contains_on_container_id" ON "kithe_model_contains" ("container_id")[0m
+ [1m[35m (6.6ms)[0m [1m[35mDROP TABLE IF EXISTS "kithe_models" CASCADE[0m
+ [1m[35m (5.2ms)[0m [1m[35mCREATE TABLE "kithe_models" ("id" uuid DEFAULT gen_random_uuid() NOT NULL PRIMARY KEY, "title" character varying NOT NULL, "type" character varying NOT NULL, "position" integer, "json_attributes" jsonb, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "parent_id" uuid, "friendlier_id" character varying DEFAULT kithe_models_friendlier_id_gen('2821109907456'::bigint, '101559956668415'::bigint) NOT NULL, "file_data" jsonb, "representative_id" uuid, "leaf_representative_id" uuid, "kithe_model_type" integer NOT NULL)[0m
+ [1m[35m (1.5ms)[0m [1m[35mCREATE UNIQUE INDEX "index_kithe_models_on_friendlier_id" ON "kithe_models" ("friendlier_id")[0m
+ [1m[35m (1.3ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_leaf_representative_id" ON "kithe_models" ("leaf_representative_id")[0m
+ [1m[35m (1.3ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_parent_id" ON "kithe_models" ("parent_id")[0m
+ [1m[35m (1.3ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_representative_id" ON "kithe_models" ("representative_id")[0m
+ [1m[35m (4.5ms)[0m [1m[35mCREATE TABLE "plain_old_ar" ("id" bigserial primary key, "title" character varying, "description" text)[0m
+ [1m[35m (6.6ms)[0m [1m[35mALTER TABLE "kithe_derivatives" ADD CONSTRAINT "fk_rails_3dac8b4201"
+FOREIGN KEY ("asset_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (2.0ms)[0m [1m[35mALTER TABLE "kithe_model_contains" ADD CONSTRAINT "fk_rails_490c1158f7"
+FOREIGN KEY ("containee_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (1.7ms)[0m [1m[35mALTER TABLE "kithe_model_contains" ADD CONSTRAINT "fk_rails_091010187b"
+FOREIGN KEY ("container_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (1.8ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_403cce5c0d"
+FOREIGN KEY ("leaf_representative_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (1.7ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_90130a9780"
+FOREIGN KEY ("parent_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (1.8ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_afa93b7b5d"
+FOREIGN KEY ("representative_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (1.1ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
+ [1m[36mActiveRecord::InternalMetadata Load (0.5ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", "environment"], ["LIMIT", 1]]
+ [1m[35m (0.2ms)[0m [1m[35mBEGIN[0m
+ [1m[36mActiveRecord::InternalMetadata Update (0.5ms)[0m [1m[33mUPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3[0m [["value", "development"], ["updated_at", "2020-06-04 16:46:18.411648"], ["key", "environment"]]
+ [1m[35m (0.5ms)[0m [1m[35mCOMMIT[0m
+ [1m[36mActiveRecord::InternalMetadata Load (0.3ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", "environment"], ["LIMIT", 1]]
+ [1m[35m (0.2ms)[0m [1m[35mBEGIN[0m
+ [1m[36mActiveRecord::InternalMetadata Update (0.5ms)[0m [1m[33mUPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3[0m [["value", "test"], ["updated_at", "2020-06-04 16:46:18.418618"], ["key", "environment"]]
+ [1m[35m (0.4ms)[0m [1m[35mCOMMIT[0m
+ [1m[36mActiveRecord::InternalMetadata Load (0.4ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", "schema_sha1"], ["LIMIT", 1]]
+ [1m[35m (0.2ms)[0m [1m[35mBEGIN[0m
+ [1m[36mActiveRecord::InternalMetadata Update (0.4ms)[0m [1m[33mUPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3[0m [["value", "03c1babae3d781ef770d42f3017561a4fadf7200"], ["updated_at", "2020-06-04 16:46:18.423797"], ["key", "schema_sha1"]]
+ [1m[35m (0.5ms)[0m [1m[35mCOMMIT[0m
+ [1m[35m (1.0ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
+ [1m[35m (0.6ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
+ [1m[35m (0.3ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
+ [1m[35m (0.3ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
+ [1m[35m (0.3ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
+ [1m[35m (0.3ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
+ [1m[35m (340.9ms)[0m [1m[35mDROP DATABASE IF EXISTS "kithe_development"[0m
+ [1m[35m (224.9ms)[0m [1m[35mDROP DATABASE IF EXISTS "kithe_test"[0m
+ [1m[35m (701.4ms)[0m [1m[35mCREATE DATABASE "kithe_development" ENCODING = 'unicode'[0m
+ [1m[35m (483.4ms)[0m [1m[35mCREATE DATABASE "kithe_test" ENCODING = 'unicode'[0m
+ [1m[35mSQL (182.5ms)[0m [1m[35mCREATE EXTENSION IF NOT EXISTS "pgcrypto"[0m
+ [1m[35mSQL (0.2ms)[0m [1m[35mCREATE EXTENSION IF NOT EXISTS "plpgsql"[0m
+ [1m[35m (2.2ms)[0m [1m[35mCREATE OR REPLACE FUNCTION public.kithe_models_friendlier_id_gen(min_value bigint, max_value bigint)
+ RETURNS text
+ LANGUAGE plpgsql
+AS $function$
+ DECLARE
+ new_id_int bigint;
+ new_id_str character varying := '';
+ done bool;
+ tries integer;
+ alphabet char[] := ARRAY['0','1','2','3','4','5','6','7','8','9',
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
+ 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
+ alphabet_length integer := array_length(alphabet, 1);
+
+ BEGIN
+ done := false;
+ tries := 0;
+ WHILE (NOT done) LOOP
+ tries := tries + 1;
+ IF (tries > 3) THEN
+ RAISE 'Could not find non-conflicting friendlier_id in 3 tries';
+ END IF;
+
+ new_id_int := trunc(random() * (max_value - min_value) + min_value);
+
+ -- convert bigint to a Base-36 alphanumeric string
+ -- see https://web.archive.org/web/20130420084605/http://www.jamiebegin.com/base36-conversion-in-postgresql/
+ -- https://gist.github.com/btbytes/7159902
+ WHILE new_id_int != 0 LOOP
+ new_id_str := alphabet[(new_id_int % alphabet_length)+1] || new_id_str;
+ new_id_int := new_id_int / alphabet_length;
+ END LOOP;
+
+ done := NOT exists(SELECT 1 FROM kithe_models WHERE friendlier_id=new_id_str);
+ END LOOP;
+ RETURN new_id_str;
+ END;
+ $function$
+[0m
+ [1m[35m (0.2ms)[0m [1m[35mDROP TABLE IF EXISTS "kithe_derivatives" CASCADE[0m
+ [1m[35m (10.4ms)[0m [1m[35mCREATE TABLE "kithe_derivatives" ("id" bigserial primary key, "key" character varying NOT NULL, "file_data" jsonb, "asset_id" uuid NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)[0m
+ [1m[35m (2.6ms)[0m [1m[35mCREATE UNIQUE INDEX "index_kithe_derivatives_on_asset_id_and_key" ON "kithe_derivatives" ("asset_id", "key")[0m
+ [1m[35m (1.2ms)[0m [1m[35mCREATE INDEX "index_kithe_derivatives_on_asset_id" ON "kithe_derivatives" ("asset_id")[0m
+ [1m[35m (0.2ms)[0m [1m[35mDROP TABLE IF EXISTS "kithe_model_contains" CASCADE[0m
+ [1m[35m (1.7ms)[0m [1m[35mCREATE TABLE "kithe_model_contains" ("containee_id" uuid, "container_id" uuid)[0m
+ [1m[35m (1.2ms)[0m [1m[35mCREATE INDEX "index_kithe_model_contains_on_containee_id" ON "kithe_model_contains" ("containee_id")[0m
+ [1m[35m (1.3ms)[0m [1m[35mCREATE INDEX "index_kithe_model_contains_on_container_id" ON "kithe_model_contains" ("container_id")[0m
+ [1m[35m (0.3ms)[0m [1m[35mDROP TABLE IF EXISTS "kithe_models" CASCADE[0m
+ [1m[35m (4.2ms)[0m [1m[35mCREATE TABLE "kithe_models" ("id" uuid DEFAULT gen_random_uuid() NOT NULL PRIMARY KEY, "title" character varying NOT NULL, "type" character varying NOT NULL, "position" integer, "json_attributes" jsonb, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "parent_id" uuid, "friendlier_id" character varying DEFAULT kithe_models_friendlier_id_gen('2821109907456'::bigint, '101559956668415'::bigint) NOT NULL, "file_data" jsonb, "representative_id" uuid, "leaf_representative_id" uuid, "kithe_model_type" integer NOT NULL)[0m
+ [1m[35m (1.3ms)[0m [1m[35mCREATE UNIQUE INDEX "index_kithe_models_on_friendlier_id" ON "kithe_models" ("friendlier_id")[0m
+ [1m[35m (1.3ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_leaf_representative_id" ON "kithe_models" ("leaf_representative_id")[0m
+ [1m[35m (1.5ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_parent_id" ON "kithe_models" ("parent_id")[0m
+ [1m[35m (1.3ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_representative_id" ON "kithe_models" ("representative_id")[0m
+ [1m[35m (8.7ms)[0m [1m[35mCREATE TABLE "plain_old_ars" ("id" bigserial primary key, "title" character varying, "description" text)[0m
+ [1m[35m (3.4ms)[0m [1m[35mALTER TABLE "kithe_derivatives" ADD CONSTRAINT "fk_rails_3dac8b4201"
+FOREIGN KEY ("asset_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (1.8ms)[0m [1m[35mALTER TABLE "kithe_model_contains" ADD CONSTRAINT "fk_rails_490c1158f7"
+FOREIGN KEY ("containee_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (1.8ms)[0m [1m[35mALTER TABLE "kithe_model_contains" ADD CONSTRAINT "fk_rails_091010187b"
+FOREIGN KEY ("container_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (1.8ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_403cce5c0d"
+FOREIGN KEY ("leaf_representative_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (1.7ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_90130a9780"
+FOREIGN KEY ("parent_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (1.7ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_afa93b7b5d"
+FOREIGN KEY ("representative_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (3.8ms)[0m [1m[35mCREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)[0m
+ [1m[35m (0.7ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
+ [1m[35m (5.9ms)[0m [1m[32mINSERT INTO "schema_migrations" (version) VALUES (20190404144551)[0m
+ [1m[35m (21.1ms)[0m [1m[32mINSERT INTO "schema_migrations" (version) VALUES
+(20181015143259),
+(20181015143413),
+(20181015143737),
+(20181031190647),
+(20181128185658),
+(20190103144947),
+(20190109192252);
+
+[0m
+ [1m[35m (3.3ms)[0m [1m[35mCREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp(6) NOT NULL, "updated_at" timestamp(6) NOT NULL)[0m
+ [1m[36mActiveRecord::InternalMetadata Load (1.3ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", "environment"], ["LIMIT", 1]]
+ [1m[35m (0.7ms)[0m [1m[35mBEGIN[0m
+ [1m[36mActiveRecord::InternalMetadata Create (0.6ms)[0m [1m[32mINSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key"[0m [["key", "environment"], ["value", "development"], ["created_at", "2020-06-04 16:47:04.539998"], ["updated_at", "2020-06-04 16:47:04.539998"]]
+ [1m[35m (0.5ms)[0m [1m[35mCOMMIT[0m
+ [1m[36mActiveRecord::InternalMetadata Load (0.4ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", "environment"], ["LIMIT", 1]]
+ [1m[36mActiveRecord::InternalMetadata Load (1.2ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", "schema_sha1"], ["LIMIT", 1]]
+ [1m[35m (0.2ms)[0m [1m[35mBEGIN[0m
+ [1m[36mActiveRecord::InternalMetadata Create (0.4ms)[0m [1m[32mINSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key"[0m [["key", "schema_sha1"], ["value", "6d88defc9e286449197e3c57b6342e1510b872dd"], ["created_at", "2020-06-04 16:47:04.552438"], ["updated_at", "2020-06-04 16:47:04.552438"]]
+ [1m[35m (0.4ms)[0m [1m[35mCOMMIT[0m
+ [1m[35mSQL (15.3ms)[0m [1m[35mCREATE EXTENSION IF NOT EXISTS "pgcrypto"[0m
+ [1m[35mSQL (0.2ms)[0m [1m[35mCREATE EXTENSION IF NOT EXISTS "plpgsql"[0m
+ [1m[35m (2.5ms)[0m [1m[35mCREATE OR REPLACE FUNCTION public.kithe_models_friendlier_id_gen(min_value bigint, max_value bigint)
+ RETURNS text
+ LANGUAGE plpgsql
+AS $function$
+ DECLARE
+ new_id_int bigint;
+ new_id_str character varying := '';
+ done bool;
+ tries integer;
+ alphabet char[] := ARRAY['0','1','2','3','4','5','6','7','8','9',
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
+ 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
+ alphabet_length integer := array_length(alphabet, 1);
+
+ BEGIN
+ done := false;
+ tries := 0;
+ WHILE (NOT done) LOOP
+ tries := tries + 1;
+ IF (tries > 3) THEN
+ RAISE 'Could not find non-conflicting friendlier_id in 3 tries';
+ END IF;
+
+ new_id_int := trunc(random() * (max_value - min_value) + min_value);
+
+ -- convert bigint to a Base-36 alphanumeric string
+ -- see https://web.archive.org/web/20130420084605/http://www.jamiebegin.com/base36-conversion-in-postgresql/
+ -- https://gist.github.com/btbytes/7159902
+ WHILE new_id_int != 0 LOOP
+ new_id_str := alphabet[(new_id_int % alphabet_length)+1] || new_id_str;
+ new_id_int := new_id_int / alphabet_length;
+ END LOOP;
+
+ done := NOT exists(SELECT 1 FROM kithe_models WHERE friendlier_id=new_id_str);
+ END LOOP;
+ RETURN new_id_str;
+ END;
+ $function$
+[0m
+ [1m[35m (0.2ms)[0m [1m[35mDROP TABLE IF EXISTS "kithe_derivatives" CASCADE[0m
+ [1m[35m (11.5ms)[0m [1m[35mCREATE TABLE "kithe_derivatives" ("id" bigserial primary key, "key" character varying NOT NULL, "file_data" jsonb, "asset_id" uuid NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)[0m
+ [1m[35m (1.8ms)[0m [1m[35mCREATE UNIQUE INDEX "index_kithe_derivatives_on_asset_id_and_key" ON "kithe_derivatives" ("asset_id", "key")[0m
+ [1m[35m (1.2ms)[0m [1m[35mCREATE INDEX "index_kithe_derivatives_on_asset_id" ON "kithe_derivatives" ("asset_id")[0m
+ [1m[35m (0.2ms)[0m [1m[35mDROP TABLE IF EXISTS "kithe_model_contains" CASCADE[0m
+ [1m[35m (1.2ms)[0m [1m[35mCREATE TABLE "kithe_model_contains" ("containee_id" uuid, "container_id" uuid)[0m
+ [1m[35m (1.2ms)[0m [1m[35mCREATE INDEX "index_kithe_model_contains_on_containee_id" ON "kithe_model_contains" ("containee_id")[0m
+ [1m[35m (1.2ms)[0m [1m[35mCREATE INDEX "index_kithe_model_contains_on_container_id" ON "kithe_model_contains" ("container_id")[0m
+ [1m[35m (0.4ms)[0m [1m[35mDROP TABLE IF EXISTS "kithe_models" CASCADE[0m
+ [1m[35m (3.8ms)[0m [1m[35mCREATE TABLE "kithe_models" ("id" uuid DEFAULT gen_random_uuid() NOT NULL PRIMARY KEY, "title" character varying NOT NULL, "type" character varying NOT NULL, "position" integer, "json_attributes" jsonb, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "parent_id" uuid, "friendlier_id" character varying DEFAULT kithe_models_friendlier_id_gen('2821109907456'::bigint, '101559956668415'::bigint) NOT NULL, "file_data" jsonb, "representative_id" uuid, "leaf_representative_id" uuid, "kithe_model_type" integer NOT NULL)[0m
+ [1m[35m (1.7ms)[0m [1m[35mCREATE UNIQUE INDEX "index_kithe_models_on_friendlier_id" ON "kithe_models" ("friendlier_id")[0m
+ [1m[35m (1.3ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_leaf_representative_id" ON "kithe_models" ("leaf_representative_id")[0m
+ [1m[35m (1.2ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_parent_id" ON "kithe_models" ("parent_id")[0m
+ [1m[35m (1.1ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_representative_id" ON "kithe_models" ("representative_id")[0m
+ [1m[35m (4.5ms)[0m [1m[35mCREATE TABLE "plain_old_ars" ("id" bigserial primary key, "title" character varying, "description" text)[0m
+ [1m[35m (6.5ms)[0m [1m[35mALTER TABLE "kithe_derivatives" ADD CONSTRAINT "fk_rails_3dac8b4201"
+FOREIGN KEY ("asset_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (2.1ms)[0m [1m[35mALTER TABLE "kithe_model_contains" ADD CONSTRAINT "fk_rails_490c1158f7"
+FOREIGN KEY ("containee_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (1.7ms)[0m [1m[35mALTER TABLE "kithe_model_contains" ADD CONSTRAINT "fk_rails_091010187b"
+FOREIGN KEY ("container_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (3.1ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_403cce5c0d"
+FOREIGN KEY ("leaf_representative_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (19.0ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_90130a9780"
+FOREIGN KEY ("parent_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (7.7ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_afa93b7b5d"
+FOREIGN KEY ("representative_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (7.0ms)[0m [1m[35mCREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)[0m
+ [1m[35m (0.7ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
+ [1m[35m (0.8ms)[0m [1m[32mINSERT INTO "schema_migrations" (version) VALUES (20190404144551)[0m
+ [1m[35m (0.6ms)[0m [1m[32mINSERT INTO "schema_migrations" (version) VALUES
+(20181015143259),
+(20181015143413),
+(20181015143737),
+(20181031190647),
+(20181128185658),
+(20190103144947),
+(20190109192252);
+
+[0m
+ [1m[35m (4.1ms)[0m [1m[35mCREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp(6) NOT NULL, "updated_at" timestamp(6) NOT NULL)[0m
+ [1m[36mActiveRecord::InternalMetadata Load (1.0ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", "environment"], ["LIMIT", 1]]
+ [1m[35m (0.2ms)[0m [1m[35mBEGIN[0m
+ [1m[36mActiveRecord::InternalMetadata Create (0.8ms)[0m [1m[32mINSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key"[0m [["key", "environment"], ["value", "development"], ["created_at", "2020-06-04 16:47:04.783078"], ["updated_at", "2020-06-04 16:47:04.783078"]]
+ [1m[35m (0.4ms)[0m [1m[35mCOMMIT[0m
+ [1m[36mActiveRecord::InternalMetadata Load (0.3ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", "environment"], ["LIMIT", 1]]
+ [1m[35m (0.1ms)[0m [1m[35mBEGIN[0m
+ [1m[36mActiveRecord::InternalMetadata Update (0.4ms)[0m [1m[33mUPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3[0m [["value", "test"], ["updated_at", "2020-06-04 16:47:04.789820"], ["key", "environment"]]
+ [1m[35m (0.4ms)[0m [1m[35mCOMMIT[0m
+ [1m[36mActiveRecord::InternalMetadata Load (0.3ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", "schema_sha1"], ["LIMIT", 1]]
+ [1m[35m (0.1ms)[0m [1m[35mBEGIN[0m
+ [1m[36mActiveRecord::InternalMetadata Create (0.4ms)[0m [1m[32mINSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key"[0m [["key", "schema_sha1"], ["value", "6d88defc9e286449197e3c57b6342e1510b872dd"], ["created_at", "2020-06-04 16:47:04.795239"], ["updated_at", "2020-06-04 16:47:04.795239"]]
+ [1m[35m (0.4ms)[0m [1m[35mCOMMIT[0m
+ [1m[35m (0.9ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
+ [1m[36mPlainOldAr Load (0.4ms)[0m [1m[34mSELECT "plain_old_ars".* FROM "plain_old_ars" ORDER BY "plain_old_ars"."id" ASC LIMIT $1[0m [["LIMIT", 1]]
+ [1m[35m (1.0ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
+ [1m[35m (0.4ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
+ [1m[35m (0.3ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
+ [1m[35m (0.3ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
+ [1m[35m (0.3ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
+ [1m[35m (0.2ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
+ [1m[35m (227.8ms)[0m [1m[35mDROP DATABASE IF EXISTS "kithe_development"[0m
+ [1m[35m (217.1ms)[0m [1m[35mDROP DATABASE IF EXISTS "kithe_test"[0m
+ [1m[35m (496.1ms)[0m [1m[35mCREATE DATABASE "kithe_development" ENCODING = 'unicode'[0m
+ [1m[35m (495.5ms)[0m [1m[35mCREATE DATABASE "kithe_test" ENCODING = 'unicode'[0m
+ [1m[35mSQL (25.2ms)[0m [1m[35mCREATE EXTENSION IF NOT EXISTS "pgcrypto"[0m
+ [1m[35mSQL (0.3ms)[0m [1m[35mCREATE EXTENSION IF NOT EXISTS "plpgsql"[0m
+ [1m[35m (23.8ms)[0m [1m[35mCREATE OR REPLACE FUNCTION public.kithe_models_friendlier_id_gen(min_value bigint, max_value bigint)
+ RETURNS text
+ LANGUAGE plpgsql
+AS $function$
+ DECLARE
+ new_id_int bigint;
+ new_id_str character varying := '';
+ done bool;
+ tries integer;
+ alphabet char[] := ARRAY['0','1','2','3','4','5','6','7','8','9',
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
+ 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
+ alphabet_length integer := array_length(alphabet, 1);
+
+ BEGIN
+ done := false;
+ tries := 0;
+ WHILE (NOT done) LOOP
+ tries := tries + 1;
+ IF (tries > 3) THEN
+ RAISE 'Could not find non-conflicting friendlier_id in 3 tries';
+ END IF;
+
+ new_id_int := trunc(random() * (max_value - min_value) + min_value);
+
+ -- convert bigint to a Base-36 alphanumeric string
+ -- see https://web.archive.org/web/20130420084605/http://www.jamiebegin.com/base36-conversion-in-postgresql/
+ -- https://gist.github.com/btbytes/7159902
+ WHILE new_id_int != 0 LOOP
+ new_id_str := alphabet[(new_id_int % alphabet_length)+1] || new_id_str;
+ new_id_int := new_id_int / alphabet_length;
+ END LOOP;
+
+ done := NOT exists(SELECT 1 FROM kithe_models WHERE friendlier_id=new_id_str);
+ END LOOP;
+ RETURN new_id_str;
+ END;
+ $function$
+[0m
+ [1m[35m (0.3ms)[0m [1m[35mDROP TABLE IF EXISTS "kithe_derivatives" CASCADE[0m
+ [1m[35m (20.8ms)[0m [1m[35mCREATE TABLE "kithe_derivatives" ("id" bigserial primary key, "key" character varying NOT NULL, "file_data" jsonb, "asset_id" uuid NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)[0m
+ [1m[35m (2.1ms)[0m [1m[35mCREATE UNIQUE INDEX "index_kithe_derivatives_on_asset_id_and_key" ON "kithe_derivatives" ("asset_id", "key")[0m
+ [1m[35m (1.1ms)[0m [1m[35mCREATE INDEX "index_kithe_derivatives_on_asset_id" ON "kithe_derivatives" ("asset_id")[0m
+ [1m[35m (0.2ms)[0m [1m[35mDROP TABLE IF EXISTS "kithe_model_contains" CASCADE[0m
+ [1m[35m (1.1ms)[0m [1m[35mCREATE TABLE "kithe_model_contains" ("containee_id" uuid, "container_id" uuid)[0m
+ [1m[35m (1.4ms)[0m [1m[35mCREATE INDEX "index_kithe_model_contains_on_containee_id" ON "kithe_model_contains" ("containee_id")[0m
+ [1m[35m (1.1ms)[0m [1m[35mCREATE INDEX "index_kithe_model_contains_on_container_id" ON "kithe_model_contains" ("container_id")[0m
+ [1m[35m (0.2ms)[0m [1m[35mDROP TABLE IF EXISTS "kithe_models" CASCADE[0m
+ [1m[35m (4.2ms)[0m [1m[35mCREATE TABLE "kithe_models" ("id" uuid DEFAULT gen_random_uuid() NOT NULL PRIMARY KEY, "title" character varying NOT NULL, "type" character varying NOT NULL, "position" integer, "json_attributes" jsonb, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "parent_id" uuid, "friendlier_id" character varying DEFAULT kithe_models_friendlier_id_gen('2821109907456'::bigint, '101559956668415'::bigint) NOT NULL, "file_data" jsonb, "representative_id" uuid, "leaf_representative_id" uuid, "kithe_model_type" integer NOT NULL)[0m
+ [1m[35m (1.2ms)[0m [1m[35mCREATE UNIQUE INDEX "index_kithe_models_on_friendlier_id" ON "kithe_models" ("friendlier_id")[0m
+ [1m[35m (1.8ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_leaf_representative_id" ON "kithe_models" ("leaf_representative_id")[0m
+ [1m[35m (6.3ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_parent_id" ON "kithe_models" ("parent_id")[0m
+ [1m[35m (1.8ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_representative_id" ON "kithe_models" ("representative_id")[0m
+ [1m[35m (3.6ms)[0m [1m[35mCREATE TABLE "plain_active_records" ("id" bigserial primary key, "title" character varying, "description" text)[0m
+ [1m[35m (3.2ms)[0m [1m[35mALTER TABLE "kithe_derivatives" ADD CONSTRAINT "fk_rails_3dac8b4201"
+FOREIGN KEY ("asset_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (136.8ms)[0m [1m[35mALTER TABLE "kithe_model_contains" ADD CONSTRAINT "fk_rails_490c1158f7"
+FOREIGN KEY ("containee_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (1.9ms)[0m [1m[35mALTER TABLE "kithe_model_contains" ADD CONSTRAINT "fk_rails_091010187b"
+FOREIGN KEY ("container_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (3.0ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_403cce5c0d"
+FOREIGN KEY ("leaf_representative_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (1.9ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_90130a9780"
+FOREIGN KEY ("parent_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (1.7ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_afa93b7b5d"
+FOREIGN KEY ("representative_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (2.9ms)[0m [1m[35mCREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)[0m
+ [1m[35m (0.9ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
+ [1m[35m (1.1ms)[0m [1m[32mINSERT INTO "schema_migrations" (version) VALUES (20190404144551)[0m
+ [1m[35m (0.6ms)[0m [1m[32mINSERT INTO "schema_migrations" (version) VALUES
+(20181015143259),
+(20181015143413),
+(20181015143737),
+(20181031190647),
+(20181128185658),
+(20190103144947),
+(20190109192252);
+
+[0m
+ [1m[35m (3.3ms)[0m [1m[35mCREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp(6) NOT NULL, "updated_at" timestamp(6) NOT NULL)[0m
+ [1m[36mActiveRecord::InternalMetadata Load (0.4ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", "environment"], ["LIMIT", 1]]
+ [1m[35m (0.2ms)[0m [1m[35mBEGIN[0m
+ [1m[36mActiveRecord::InternalMetadata Create (0.5ms)[0m [1m[32mINSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key"[0m [["key", "environment"], ["value", "development"], ["created_at", "2020-06-04 16:49:37.613161"], ["updated_at", "2020-06-04 16:49:37.613161"]]
+ [1m[35m (0.4ms)[0m [1m[35mCOMMIT[0m
+ [1m[36mActiveRecord::InternalMetadata Load (0.4ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", "environment"], ["LIMIT", 1]]
+ [1m[36mActiveRecord::InternalMetadata Load (0.3ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", "schema_sha1"], ["LIMIT", 1]]
+ [1m[35m (0.1ms)[0m [1m[35mBEGIN[0m
+ [1m[36mActiveRecord::InternalMetadata Create (0.3ms)[0m [1m[32mINSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key"[0m [["key", "schema_sha1"], ["value", "7ac4a20ed84fd4d14ae476bfa58fc376b3ce6739"], ["created_at", "2020-06-04 16:49:37.623813"], ["updated_at", "2020-06-04 16:49:37.623813"]]
+ [1m[35m (0.3ms)[0m [1m[35mCOMMIT[0m
+ [1m[35mSQL (15.0ms)[0m [1m[35mCREATE EXTENSION IF NOT EXISTS "pgcrypto"[0m
+ [1m[35mSQL (0.2ms)[0m [1m[35mCREATE EXTENSION IF NOT EXISTS "plpgsql"[0m
+ [1m[35m (2.2ms)[0m [1m[35mCREATE OR REPLACE FUNCTION public.kithe_models_friendlier_id_gen(min_value bigint, max_value bigint)
+ RETURNS text
+ LANGUAGE plpgsql
+AS $function$
+ DECLARE
+ new_id_int bigint;
+ new_id_str character varying := '';
+ done bool;
+ tries integer;
+ alphabet char[] := ARRAY['0','1','2','3','4','5','6','7','8','9',
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
+ 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
+ alphabet_length integer := array_length(alphabet, 1);
+
+ BEGIN
+ done := false;
+ tries := 0;
+ WHILE (NOT done) LOOP
+ tries := tries + 1;
+ IF (tries > 3) THEN
+ RAISE 'Could not find non-conflicting friendlier_id in 3 tries';
+ END IF;
+
+ new_id_int := trunc(random() * (max_value - min_value) + min_value);
+
+ -- convert bigint to a Base-36 alphanumeric string
+ -- see https://web.archive.org/web/20130420084605/http://www.jamiebegin.com/base36-conversion-in-postgresql/
+ -- https://gist.github.com/btbytes/7159902
+ WHILE new_id_int != 0 LOOP
+ new_id_str := alphabet[(new_id_int % alphabet_length)+1] || new_id_str;
+ new_id_int := new_id_int / alphabet_length;
+ END LOOP;
+
+ done := NOT exists(SELECT 1 FROM kithe_models WHERE friendlier_id=new_id_str);
+ END LOOP;
+ RETURN new_id_str;
+ END;
+ $function$
+[0m
+ [1m[35m (0.2ms)[0m [1m[35mDROP TABLE IF EXISTS "kithe_derivatives" CASCADE[0m
+ [1m[35m (31.4ms)[0m [1m[35mCREATE TABLE "kithe_derivatives" ("id" bigserial primary key, "key" character varying NOT NULL, "file_data" jsonb, "asset_id" uuid NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)[0m
+ [1m[35m (4.3ms)[0m [1m[35mCREATE UNIQUE INDEX "index_kithe_derivatives_on_asset_id_and_key" ON "kithe_derivatives" ("asset_id", "key")[0m
+ [1m[35m (1.1ms)[0m [1m[35mCREATE INDEX "index_kithe_derivatives_on_asset_id" ON "kithe_derivatives" ("asset_id")[0m
+ [1m[35m (0.2ms)[0m [1m[35mDROP TABLE IF EXISTS "kithe_model_contains" CASCADE[0m
+ [1m[35m (2.4ms)[0m [1m[35mCREATE TABLE "kithe_model_contains" ("containee_id" uuid, "container_id" uuid)[0m
+ [1m[35m (1.8ms)[0m [1m[35mCREATE INDEX "index_kithe_model_contains_on_containee_id" ON "kithe_model_contains" ("containee_id")[0m
+ [1m[35m (1.7ms)[0m [1m[35mCREATE INDEX "index_kithe_model_contains_on_container_id" ON "kithe_model_contains" ("container_id")[0m
+ [1m[35m (3.8ms)[0m [1m[35mDROP TABLE IF EXISTS "kithe_models" CASCADE[0m
+ [1m[35m (4.8ms)[0m [1m[35mCREATE TABLE "kithe_models" ("id" uuid DEFAULT gen_random_uuid() NOT NULL PRIMARY KEY, "title" character varying NOT NULL, "type" character varying NOT NULL, "position" integer, "json_attributes" jsonb, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "parent_id" uuid, "friendlier_id" character varying DEFAULT kithe_models_friendlier_id_gen('2821109907456'::bigint, '101559956668415'::bigint) NOT NULL, "file_data" jsonb, "representative_id" uuid, "leaf_representative_id" uuid, "kithe_model_type" integer NOT NULL)[0m
+ [1m[35m (1.1ms)[0m [1m[35mCREATE UNIQUE INDEX "index_kithe_models_on_friendlier_id" ON "kithe_models" ("friendlier_id")[0m
+ [1m[35m (1.2ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_leaf_representative_id" ON "kithe_models" ("leaf_representative_id")[0m
+ [1m[35m (3.1ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_parent_id" ON "kithe_models" ("parent_id")[0m
+ [1m[35m (1.4ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_representative_id" ON "kithe_models" ("representative_id")[0m
+ [1m[35m (10.2ms)[0m [1m[35mCREATE TABLE "plain_active_records" ("id" bigserial primary key, "title" character varying, "description" text)[0m
+ [1m[35m (4.9ms)[0m [1m[35mALTER TABLE "kithe_derivatives" ADD CONSTRAINT "fk_rails_3dac8b4201"
+FOREIGN KEY ("asset_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (3.0ms)[0m [1m[35mALTER TABLE "kithe_model_contains" ADD CONSTRAINT "fk_rails_490c1158f7"
+FOREIGN KEY ("containee_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (5.0ms)[0m [1m[35mALTER TABLE "kithe_model_contains" ADD CONSTRAINT "fk_rails_091010187b"
+FOREIGN KEY ("container_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (14.1ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_403cce5c0d"
+FOREIGN KEY ("leaf_representative_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (6.8ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_90130a9780"
+FOREIGN KEY ("parent_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (8.0ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_afa93b7b5d"
+FOREIGN KEY ("representative_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (14.5ms)[0m [1m[35mCREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)[0m
+ [1m[35m (0.6ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
+ [1m[35m (0.7ms)[0m [1m[32mINSERT INTO "schema_migrations" (version) VALUES (20190404144551)[0m
+ [1m[35m (0.7ms)[0m [1m[32mINSERT INTO "schema_migrations" (version) VALUES
+(20181015143259),
+(20181015143413),
+(20181015143737),
+(20181031190647),
+(20181128185658),
+(20190103144947),
+(20190109192252);
+
+[0m
+ [1m[35m (3.8ms)[0m [1m[35mCREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp(6) NOT NULL, "updated_at" timestamp(6) NOT NULL)[0m
+ [1m[36mActiveRecord::InternalMetadata Load (0.5ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", "environment"], ["LIMIT", 1]]
+ [1m[35m (0.2ms)[0m [1m[35mBEGIN[0m
+ [1m[36mActiveRecord::InternalMetadata Create (0.6ms)[0m [1m[32mINSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key"[0m [["key", "environment"], ["value", "development"], ["created_at", "2020-06-04 16:49:37.900916"], ["updated_at", "2020-06-04 16:49:37.900916"]]
+ [1m[35m (0.6ms)[0m [1m[35mCOMMIT[0m
+ [1m[36mActiveRecord::InternalMetadata Load (0.4ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", "environment"], ["LIMIT", 1]]
+ [1m[35m (0.2ms)[0m [1m[35mBEGIN[0m
+ [1m[36mActiveRecord::InternalMetadata Update (0.6ms)[0m [1m[33mUPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3[0m [["value", "test"], ["updated_at", "2020-06-04 16:49:37.909774"], ["key", "environment"]]
+ [1m[35m (0.7ms)[0m [1m[35mCOMMIT[0m
+ [1m[36mActiveRecord::InternalMetadata Load (0.6ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", "schema_sha1"], ["LIMIT", 1]]
+ [1m[35m (0.2ms)[0m [1m[35mBEGIN[0m
+ [1m[36mActiveRecord::InternalMetadata Create (0.3ms)[0m [1m[32mINSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key"[0m [["key", "schema_sha1"], ["value", "7ac4a20ed84fd4d14ae476bfa58fc376b3ce6739"], ["created_at", "2020-06-04 16:49:37.920363"], ["updated_at", "2020-06-04 16:49:37.920363"]]
+ [1m[35m (0.4ms)[0m [1m[35mCOMMIT[0m
+ [1m[35m (1.4ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
+ [1m[35m (3.5ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
+ [1m[35m (22.8ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
+ [1m[35m (0.3ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
+ [1m[35m (0.3ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
+ [1m[35m (0.3ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
+ [1m[35m (0.4ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
+ [1m[35m (364.2ms)[0m [1m[35mDROP DATABASE IF EXISTS "kithe_test"[0m
+ [1m[35m (864.3ms)[0m [1m[35mCREATE DATABASE "kithe_test" ENCODING = 'unicode'[0m
+ [1m[35mSQL (64.0ms)[0m [1m[35mCREATE EXTENSION IF NOT EXISTS "pgcrypto"[0m
+ [1m[35mSQL (1.5ms)[0m [1m[35mCREATE EXTENSION IF NOT EXISTS "plpgsql"[0m
+ [1m[35m (10.4ms)[0m [1m[35mCREATE OR REPLACE FUNCTION public.kithe_models_friendlier_id_gen(min_value bigint, max_value bigint)
+ RETURNS text
+ LANGUAGE plpgsql
+AS $function$
+ DECLARE
+ new_id_int bigint;
+ new_id_str character varying := '';
+ done bool;
+ tries integer;
+ alphabet char[] := ARRAY['0','1','2','3','4','5','6','7','8','9',
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
+ 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
+ alphabet_length integer := array_length(alphabet, 1);
+
+ BEGIN
+ done := false;
+ tries := 0;
+ WHILE (NOT done) LOOP
+ tries := tries + 1;
+ IF (tries > 3) THEN
+ RAISE 'Could not find non-conflicting friendlier_id in 3 tries';
+ END IF;
+
+ new_id_int := trunc(random() * (max_value - min_value) + min_value);
+
+ -- convert bigint to a Base-36 alphanumeric string
+ -- see https://web.archive.org/web/20130420084605/http://www.jamiebegin.com/base36-conversion-in-postgresql/
+ -- https://gist.github.com/btbytes/7159902
+ WHILE new_id_int != 0 LOOP
+ new_id_str := alphabet[(new_id_int % alphabet_length)+1] || new_id_str;
+ new_id_int := new_id_int / alphabet_length;
+ END LOOP;
+
+ done := NOT exists(SELECT 1 FROM kithe_models WHERE friendlier_id=new_id_str);
+ END LOOP;
+ RETURN new_id_str;
+ END;
+ $function$
+[0m
+ [1m[35m (0.5ms)[0m [1m[35mDROP TABLE IF EXISTS "kithe_derivatives" CASCADE[0m
+ [1m[35m (34.0ms)[0m [1m[35mCREATE TABLE "kithe_derivatives" ("id" bigserial primary key, "key" character varying NOT NULL, "file_data" jsonb, "asset_id" uuid NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)[0m
+ [1m[35m (2.0ms)[0m [1m[35mCREATE UNIQUE INDEX "index_kithe_derivatives_on_asset_id_and_key" ON "kithe_derivatives" ("asset_id", "key")[0m
+ [1m[35m (2.0ms)[0m [1m[35mCREATE INDEX "index_kithe_derivatives_on_asset_id" ON "kithe_derivatives" ("asset_id")[0m
+ [1m[35m (0.5ms)[0m [1m[35mDROP TABLE IF EXISTS "kithe_model_contains" CASCADE[0m
+ [1m[35m (2.1ms)[0m [1m[35mCREATE TABLE "kithe_model_contains" ("containee_id" uuid, "container_id" uuid)[0m
+ [1m[35m (5.0ms)[0m [1m[35mCREATE INDEX "index_kithe_model_contains_on_containee_id" ON "kithe_model_contains" ("containee_id")[0m
+ [1m[35m (1.6ms)[0m [1m[35mCREATE INDEX "index_kithe_model_contains_on_container_id" ON "kithe_model_contains" ("container_id")[0m
+ [1m[35m (0.3ms)[0m [1m[35mDROP TABLE IF EXISTS "kithe_models" CASCADE[0m
+ [1m[35m (29.4ms)[0m [1m[35mCREATE TABLE "kithe_models" ("id" uuid DEFAULT gen_random_uuid() NOT NULL PRIMARY KEY, "title" character varying NOT NULL, "type" character varying NOT NULL, "position" integer, "json_attributes" jsonb, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "parent_id" uuid, "friendlier_id" character varying DEFAULT kithe_models_friendlier_id_gen('2821109907456'::bigint, '101559956668415'::bigint) NOT NULL, "file_data" jsonb, "representative_id" uuid, "leaf_representative_id" uuid, "kithe_model_type" integer NOT NULL)[0m
+ [1m[35m (1.6ms)[0m [1m[35mCREATE UNIQUE INDEX "index_kithe_models_on_friendlier_id" ON "kithe_models" ("friendlier_id")[0m
+ [1m[35m (3.2ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_leaf_representative_id" ON "kithe_models" ("leaf_representative_id")[0m
+ [1m[35m (1.4ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_parent_id" ON "kithe_models" ("parent_id")[0m
+ [1m[35m (6.3ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_representative_id" ON "kithe_models" ("representative_id")[0m
+ [1m[35m (4.3ms)[0m [1m[35mALTER TABLE "kithe_derivatives" ADD CONSTRAINT "fk_rails_3dac8b4201"
+FOREIGN KEY ("asset_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (3.4ms)[0m [1m[35mALTER TABLE "kithe_model_contains" ADD CONSTRAINT "fk_rails_490c1158f7"
+FOREIGN KEY ("containee_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (3.0ms)[0m [1m[35mALTER TABLE "kithe_model_contains" ADD CONSTRAINT "fk_rails_091010187b"
+FOREIGN KEY ("container_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (4.3ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_403cce5c0d"
+FOREIGN KEY ("leaf_representative_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (3.0ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_90130a9780"
+FOREIGN KEY ("parent_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (3.7ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_afa93b7b5d"
+FOREIGN KEY ("representative_id")
+ REFERENCES "kithe_models" ("id")
+[0m
+ [1m[35m (5.8ms)[0m [1m[35mCREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)[0m
+ [1m[35m (1.7ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
+ [1m[35m (8.9ms)[0m [1m[32mINSERT INTO "schema_migrations" (version) VALUES (20190404144551)[0m
+ [1m[35m (11.8ms)[0m [1m[32mINSERT INTO "schema_migrations" (version) VALUES
+(20181015143259),
+(20181015143413),
+(20181015143737),
+(20181031190647),
+(20181128185658),
+(20190103144947),
+(20190109192252);
+
+[0m
+ [1m[35m (5.6ms)[0m [1m[35mCREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp(6) NOT NULL, "updated_at" timestamp(6) NOT NULL)[0m
+ [1m[36mActiveRecord::InternalMetadata Load (0.6ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", "environment"], ["LIMIT", 1]]
+ [1m[35m (0.4ms)[0m [1m[35mBEGIN[0m
+ [1m[36mActiveRecord::InternalMetadata Create (0.9ms)[0m [1m[32mINSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key"[0m [["key", "environment"], ["value", "development"], ["created_at", "2020-11-11 21:42:07.161354"], ["updated_at", "2020-11-11 21:42:07.161354"]]
+ [1m[35m (0.4ms)[0m [1m[35mCOMMIT[0m
+ [1m[36mActiveRecord::InternalMetadata Load (0.4ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", "environment"], ["LIMIT", 1]]
+ [1m[35m (0.4ms)[0m [1m[35mBEGIN[0m
+ [1m[36mActiveRecord::InternalMetadata Update (0.5ms)[0m [1m[33mUPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3[0m [["value", "test"], ["updated_at", "2020-11-11 21:42:07.170009"], ["key", "environment"]]
+ [1m[35m (0.5ms)[0m [1m[35mCOMMIT[0m
+ [1m[36mActiveRecord::InternalMetadata Load (1.1ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", "schema_sha1"], ["LIMIT", 1]]
+ [1m[35m (0.2ms)[0m [1m[35mBEGIN[0m
+ [1m[36mActiveRecord::InternalMetadata Create (0.4ms)[0m [1m[32mINSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key"[0m [["key", "schema_sha1"], ["value", "0e24e2caa948e64f3be11233d707b8abffa0f356"], ["created_at", "2020-11-11 21:42:07.182090"], ["updated_at", "2020-11-11 21:42:07.182090"]]
+ [1m[35m (0.4ms)[0m [1m[35mCOMMIT[0m