kithe 2.0.0.pre.alpha2 → 2.0.0.pre.beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/jobs/kithe/create_derivatives_job.rb +2 -2
- data/app/models/kithe/asset.rb +82 -154
- data/app/models/kithe/asset/derivative_creator.rb +32 -62
- data/app/models/kithe/asset/derivative_definition.rb +12 -13
- data/app/models/kithe/asset/set_shrine_uploader.rb +64 -0
- data/app/models/kithe/collection.rb +0 -6
- data/app/models/kithe/model.rb +0 -21
- data/app/models/kithe/work.rb +0 -5
- data/app/uploaders/kithe/asset_uploader.rb +15 -78
- data/lib/kithe/version.rb +4 -1
- data/lib/shrine/plugins/kithe_checksum_signatures.rb +41 -0
- data/lib/shrine/plugins/kithe_controllable_backgrounding.rb +53 -0
- data/lib/shrine/plugins/kithe_derivative_definitions.rb +101 -0
- data/lib/shrine/plugins/kithe_derivatives.rb +54 -0
- data/lib/shrine/plugins/kithe_determine_mime_type.rb +39 -0
- data/lib/shrine/plugins/kithe_persisted_derivatives.rb +161 -0
- data/lib/shrine/plugins/kithe_promotion_callbacks.rb +4 -0
- data/lib/shrine/plugins/kithe_promotion_directives.rb +33 -3
- data/lib/shrine/plugins/kithe_storage_location.rb +53 -4
- data/lib/tasks/kithe_tasks.rake +22 -15
- data/spec/dummy/log/development.log +867 -0
- data/spec/dummy/log/test.log +26005 -0
- data/spec/models/kithe/asset/asset_derivatives_spec.rb +137 -0
- data/spec/models/kithe/asset/asset_promotion_hooks_spec.rb +26 -5
- data/spec/models/kithe/asset/set_shrine_uploader_spec.rb +39 -0
- data/spec/models/kithe/asset_spec.rb +9 -59
- data/spec/models/kithe/model_spec.rb +0 -32
- data/spec/shrine/kithe_accept_remote_url_spec.rb +49 -0
- data/spec/shrine/kithe_checksum_signatures_spec.rb +63 -0
- data/spec/shrine/kithe_derivative_definitions_spec.rb +303 -0
- data/spec/shrine/kithe_persisted_derivatives_spec.rb +424 -0
- data/spec/shrine/kithe_storage_location_spec.rb +43 -15
- data/spec/spec_helper.rb +7 -6
- data/spec/test_support/images/3x3_pixel.jpg +0 -0
- data/spec/test_support/shrine_spec_support.rb +2 -1
- metadata +23 -23
- data/app/models/kithe/asset/derivative_updater.rb +0 -119
- data/app/models/kithe/derivative.rb +0 -15
- data/app/uploaders/kithe/derivative_uploader.rb +0 -48
- data/spec/models/kithe/asset/asset_create_derivatives_spec.rb +0 -320
- data/spec/models/kithe/derivative_spec.rb +0 -168
@@ -108670,3 +108670,870 @@ Preloading Single-Table Inheritance type Kithe::Asset for Kithe::Model
|
|
108670
108670
|
[1m[36mKithe::Asset Update (3.3ms)[0m [1m[33mUPDATE "kithe_models" SET "updated_at" = $1, "file_data" = $2 WHERE "kithe_models"."id" = $3[0m [["updated_at", "2020-05-12 19:16:26.883198"], ["file_data", "{\"id\":\"asset/e7e4d65b-b65f-43f4-a31a-9e6721a2116e/db52cb74ee881897ced47baa2bcd65c7.jpg\",\"storage\":\"store\",\"metadata\":{\"md5\":\"13a91cf5b51e9c7f0c1e4c1971d68348\",\"sha1\":\"8de724f54e231a7c41c618cf1918a1bb4070e6c9\",\"size\":209630,\"width\":717,\"height\":478,\"sha512\":\"3a7df0d5dfeb8219f379c873d33518f3f01f85e8706546a633029226a81294a0aff0858b29dffecd7f0a5816be766dd8182c58f18ae364c0798308cd17e810f6\",\"filename\":null,\"mime_type\":\"image/jpeg\",\"derivatives_created\":true},\"derivatives\":{\"animage\":{\"id\":\"e7e4d65b-b65f-43f4-a31a-9e6721a2116e/animage/a010cb42443f085e9f7a800d9051721e.jpeg\",\"storage\":\"kithe_derivatives\",\"metadata\":{\"filename\":\"kithe_models_friendlier_id_gen(1,10000000000)_animage.jpeg\",\"size\":312648,\"mime_type\":\"image/jpeg\",\"width\":2045,\"height\":1376,\"md5\":\"e55e2c43660e252ae58ab9e65912a509\",\"sha1\":\"ee867b5ea12915115a6b9706b0d281b4bf067968\",\"sha512\":\"28072fde08738656e73a2f8ee2ebc35c8df32cb86e03656285c5ce787b28df339bfe30612ae191ae818d5d1eca0cf85ec3f2643f752cb12e28d5a3b5215c3836\"}}}}"], ["id", "e7e4d65b-b65f-43f4-a31a-9e6721a2116e"]]
|
108671
108671
|
[1m[35m (0.7ms)[0m [1m[35mCOMMIT[0m
|
108672
108672
|
[1m[36mKithe::Asset Load (0.5ms)[0m [1m[34mSELECT "kithe_models"."id", "kithe_models"."title", "kithe_models"."type", "kithe_models"."position", "kithe_models"."json_attributes", "kithe_models"."created_at", "kithe_models"."updated_at", "kithe_models"."parent_id", "kithe_models"."friendlier_id", "kithe_models"."file_data", "kithe_models"."kithe_model_type" FROM "kithe_models" WHERE "kithe_models"."type" = $1 AND "kithe_models"."id" = $2 LIMIT $3[0m [["type", "Kithe::Asset"], ["id", "e7e4d65b-b65f-43f4-a31a-9e6721a2116e"], ["LIMIT", 1]]
|
108673
|
+
[1m[35m (2.6ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
108674
|
+
[1m[35m (0.9ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
108675
|
+
[1m[35m (0.8ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
108676
|
+
[1m[35m (23.7ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
|
108677
|
+
[1m[35m (0.5ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
108678
|
+
[1m[35m (0.3ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
|
108679
|
+
[1m[35m (0.3ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
108680
|
+
[1m[35m (0.2ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
|
108681
|
+
[1m[35m (233.0ms)[0m [1m[35mDROP DATABASE IF EXISTS "kithe_development"[0m
|
108682
|
+
[1m[35m (316.2ms)[0m [1m[35mDROP DATABASE IF EXISTS "kithe_test"[0m
|
108683
|
+
[1m[35m (480.0ms)[0m [1m[35mCREATE DATABASE "kithe_development" ENCODING = 'unicode'[0m
|
108684
|
+
[1m[35m (446.4ms)[0m [1m[35mCREATE DATABASE "kithe_test" ENCODING = 'unicode'[0m
|
108685
|
+
[1m[35m (6.9ms)[0m [1m[35mCREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)[0m
|
108686
|
+
[1m[35m (22.7ms)[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
|
108687
|
+
[1m[35m (0.4ms)[0m [1m[34mSELECT pg_try_advisory_lock(1601470156486188030)[0m
|
108688
|
+
[1m[35m (0.9ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
108689
|
+
Migrating to EnablePgcryptoExtension (20181015143259)
|
108690
|
+
[1m[35m (0.2ms)[0m [1m[35mBEGIN[0m
|
108691
|
+
[1m[35mSQL (33.2ms)[0m [1m[35mCREATE EXTENSION IF NOT EXISTS "pgcrypto"[0m
|
108692
|
+
[1m[36mprimary::SchemaMigration Create (0.5ms)[0m [1m[32mINSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version"[0m [["version", "20181015143259"]]
|
108693
|
+
[1m[35m (6.5ms)[0m [1m[35mCOMMIT[0m
|
108694
|
+
Migrating to CreateKitheModels (20181015143413)
|
108695
|
+
[1m[35m (0.7ms)[0m [1m[35mBEGIN[0m
|
108696
|
+
[1m[35m (28.7ms)[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)[0m
|
108697
|
+
[1m[35m (1.2ms)[0m [1m[35mALTER TABLE "kithe_models" ADD "parent_id" uuid[0m
|
108698
|
+
[1m[35m (1.3ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_parent_id" ON "kithe_models" ("parent_id")[0m
|
108699
|
+
[1m[35m (2.9ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_90130a9780"
|
108700
|
+
FOREIGN KEY ("parent_id")
|
108701
|
+
REFERENCES "kithe_models" ("id")
|
108702
|
+
[0m
|
108703
|
+
[1m[36mprimary::SchemaMigration Create (0.5ms)[0m [1m[32mINSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version"[0m [["version", "20181015143413"]]
|
108704
|
+
[1m[35m (0.8ms)[0m [1m[35mCOMMIT[0m
|
108705
|
+
Migrating to KitheModelsFriendlierId (20181015143737)
|
108706
|
+
[1m[35m (0.3ms)[0m [1m[35mBEGIN[0m
|
108707
|
+
[1m[35m (21.5ms)[0m [1m[35mCREATE OR REPLACE FUNCTION kithe_models_friendlier_id_gen(min_value bigint, max_value bigint) RETURNS text AS $$
|
108708
|
+
DECLARE
|
108709
|
+
new_id_int bigint;
|
108710
|
+
new_id_str character varying := '';
|
108711
|
+
done bool;
|
108712
|
+
tries integer;
|
108713
|
+
alphabet char[] := ARRAY['0','1','2','3','4','5','6','7','8','9',
|
108714
|
+
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
|
108715
|
+
'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
|
108716
|
+
alphabet_length integer := array_length(alphabet, 1);
|
108717
|
+
|
108718
|
+
BEGIN
|
108719
|
+
done := false;
|
108720
|
+
tries := 0;
|
108721
|
+
WHILE (NOT done) LOOP
|
108722
|
+
tries := tries + 1;
|
108723
|
+
IF (tries > 3) THEN
|
108724
|
+
RAISE 'Could not find non-conflicting friendlier_id in 3 tries';
|
108725
|
+
END IF;
|
108726
|
+
|
108727
|
+
new_id_int := trunc(random() * (max_value - min_value) + min_value);
|
108728
|
+
|
108729
|
+
-- convert bigint to a Base-36 alphanumeric string
|
108730
|
+
-- see https://web.archive.org/web/20130420084605/http://www.jamiebegin.com/base36-conversion-in-postgresql/
|
108731
|
+
-- https://gist.github.com/btbytes/7159902
|
108732
|
+
WHILE new_id_int != 0 LOOP
|
108733
|
+
new_id_str := alphabet[(new_id_int % alphabet_length)+1] || new_id_str;
|
108734
|
+
new_id_int := new_id_int / alphabet_length;
|
108735
|
+
END LOOP;
|
108736
|
+
|
108737
|
+
done := NOT exists(SELECT 1 FROM kithe_models WHERE friendlier_id=new_id_str);
|
108738
|
+
END LOOP;
|
108739
|
+
RETURN new_id_str;
|
108740
|
+
END;
|
108741
|
+
$$ LANGUAGE plpgsql;
|
108742
|
+
[0m
|
108743
|
+
[1m[35m (28.2ms)[0m [1m[35mALTER TABLE "kithe_models" ADD "friendlier_id" character varying DEFAULT kithe_models_friendlier_id_gen(2821109907456, 101559956668415) NOT NULL[0m
|
108744
|
+
[1m[35m (1.0ms)[0m [1m[35mCREATE UNIQUE INDEX "index_kithe_models_on_friendlier_id" ON "kithe_models" ("friendlier_id")[0m
|
108745
|
+
[1m[36mprimary::SchemaMigration Create (0.3ms)[0m [1m[32mINSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version"[0m [["version", "20181015143737"]]
|
108746
|
+
[1m[35m (1.2ms)[0m [1m[35mCOMMIT[0m
|
108747
|
+
Migrating to AddFileDataToModel (20181031190647)
|
108748
|
+
[1m[35m (0.3ms)[0m [1m[35mBEGIN[0m
|
108749
|
+
[1m[35m (1.0ms)[0m [1m[35mALTER TABLE "kithe_models" ADD "file_data" jsonb[0m
|
108750
|
+
[1m[36mprimary::SchemaMigration Create (0.4ms)[0m [1m[32mINSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version"[0m [["version", "20181031190647"]]
|
108751
|
+
[1m[35m (13.7ms)[0m [1m[35mCOMMIT[0m
|
108752
|
+
Migrating to CreateKitheDerivatives (20181128185658)
|
108753
|
+
[1m[35m (0.3ms)[0m [1m[35mBEGIN[0m
|
108754
|
+
[1m[35m (17.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, CONSTRAINT "fk_rails_3dac8b4201"
|
108755
|
+
FOREIGN KEY ("asset_id")
|
108756
|
+
REFERENCES "kithe_models" ("id")
|
108757
|
+
)[0m
|
108758
|
+
[1m[35m (6.2ms)[0m [1m[35mCREATE INDEX "index_kithe_derivatives_on_asset_id" ON "kithe_derivatives" ("asset_id")[0m
|
108759
|
+
[1m[35m (1.2ms)[0m [1m[35mCREATE UNIQUE INDEX "index_kithe_derivatives_on_asset_id_and_key" ON "kithe_derivatives" ("asset_id", "key")[0m
|
108760
|
+
[1m[36mprimary::SchemaMigration Create (0.4ms)[0m [1m[32mINSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version"[0m [["version", "20181128185658"]]
|
108761
|
+
[1m[35m (0.4ms)[0m [1m[35mCOMMIT[0m
|
108762
|
+
Migrating to AddRepresentativeRelations (20190103144947)
|
108763
|
+
[1m[35m (12.1ms)[0m [1m[35mBEGIN[0m
|
108764
|
+
[1m[35m (0.9ms)[0m [1m[35mALTER TABLE "kithe_models" ADD "representative_id" uuid[0m
|
108765
|
+
[1m[35m (6.7ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_representative_id" ON "kithe_models" ("representative_id")[0m
|
108766
|
+
[1m[35m (1.6ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_afa93b7b5d"
|
108767
|
+
FOREIGN KEY ("representative_id")
|
108768
|
+
REFERENCES "kithe_models" ("id")
|
108769
|
+
[0m
|
108770
|
+
[1m[35m (0.5ms)[0m [1m[35mALTER TABLE "kithe_models" ADD "leaf_representative_id" uuid[0m
|
108771
|
+
[1m[35m (1.0ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_leaf_representative_id" ON "kithe_models" ("leaf_representative_id")[0m
|
108772
|
+
[1m[35m (1.4ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_403cce5c0d"
|
108773
|
+
FOREIGN KEY ("leaf_representative_id")
|
108774
|
+
REFERENCES "kithe_models" ("id")
|
108775
|
+
[0m
|
108776
|
+
[1m[36mprimary::SchemaMigration Create (0.3ms)[0m [1m[32mINSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version"[0m [["version", "20190103144947"]]
|
108777
|
+
[1m[35m (0.4ms)[0m [1m[35mCOMMIT[0m
|
108778
|
+
Migrating to ContainsAssociation (20190109192252)
|
108779
|
+
[1m[35m (0.3ms)[0m [1m[35mBEGIN[0m
|
108780
|
+
[1m[35m (2.7ms)[0m [1m[35mCREATE TABLE "kithe_model_contains" ("containee_id" uuid, "container_id" uuid, CONSTRAINT "fk_rails_490c1158f7"
|
108781
|
+
FOREIGN KEY ("containee_id")
|
108782
|
+
REFERENCES "kithe_models" ("id")
|
108783
|
+
, CONSTRAINT "fk_rails_091010187b"
|
108784
|
+
FOREIGN KEY ("container_id")
|
108785
|
+
REFERENCES "kithe_models" ("id")
|
108786
|
+
)[0m
|
108787
|
+
[1m[35m (7.4ms)[0m [1m[35mCREATE INDEX "index_kithe_model_contains_on_containee_id" ON "kithe_model_contains" ("containee_id")[0m
|
108788
|
+
[1m[35m (5.9ms)[0m [1m[35mCREATE INDEX "index_kithe_model_contains_on_container_id" ON "kithe_model_contains" ("container_id")[0m
|
108789
|
+
[1m[36mprimary::SchemaMigration Create (0.4ms)[0m [1m[32mINSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version"[0m [["version", "20190109192252"]]
|
108790
|
+
[1m[35m (0.4ms)[0m [1m[35mCOMMIT[0m
|
108791
|
+
Migrating to KitheModelType (20190404144551)
|
108792
|
+
[1m[35m (0.3ms)[0m [1m[35mBEGIN[0m
|
108793
|
+
[1m[35m (0.7ms)[0m [1m[35mALTER TABLE "kithe_models" ADD "kithe_model_type" integer[0m
|
108794
|
+
[1m[35m (0.4ms)[0m [1m[34mSELECT "kithe_models"."id" FROM "kithe_models" ORDER BY "kithe_models"."id" ASC LIMIT $1[0m [["LIMIT", 1000]]
|
108795
|
+
[1m[35m (13.1ms)[0m [1m[35mALTER TABLE "kithe_models" ALTER COLUMN "kithe_model_type" TYPE integer, ALTER COLUMN "kithe_model_type" SET NOT NULL[0m
|
108796
|
+
[1m[36mprimary::SchemaMigration Create (0.4ms)[0m [1m[32mINSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version"[0m [["version", "20190404144551"]]
|
108797
|
+
[1m[35m (5.9ms)[0m [1m[35mCOMMIT[0m
|
108798
|
+
[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]]
|
108799
|
+
[1m[35m (0.2ms)[0m [1m[35mBEGIN[0m
|
108800
|
+
[1m[36mActiveRecord::InternalMetadata Create (0.7ms)[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-05-20 19:49:53.472252"], ["updated_at", "2020-05-20 19:49:53.472252"]]
|
108801
|
+
[1m[35m (6.1ms)[0m [1m[35mCOMMIT[0m
|
108802
|
+
[1m[35m (0.3ms)[0m [1m[34mSELECT pg_advisory_unlock(1601470156486188030)[0m
|
108803
|
+
[1m[35m (0.8ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
108804
|
+
[1m[35m (0.9ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
108805
|
+
[1m[35m (0.4ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
|
108806
|
+
[1m[35m (0.2ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
108807
|
+
[1m[35m (0.2ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
|
108808
|
+
[1m[35m (0.2ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
108809
|
+
[1m[35m (0.2ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
|
108810
|
+
[1m[35m (206.8ms)[0m [1m[35mDROP DATABASE IF EXISTS "kithe_development"[0m
|
108811
|
+
[1m[35m (203.9ms)[0m [1m[35mDROP DATABASE IF EXISTS "kithe_test"[0m
|
108812
|
+
[1m[35m (539.9ms)[0m [1m[35mCREATE DATABASE "kithe_development" ENCODING = 'unicode'[0m
|
108813
|
+
[1m[35m (419.2ms)[0m [1m[35mCREATE DATABASE "kithe_test" ENCODING = 'unicode'[0m
|
108814
|
+
[1m[35m (5.1ms)[0m [1m[35mCREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)[0m
|
108815
|
+
[1m[35m (4.4ms)[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
|
108816
|
+
[1m[35m (0.2ms)[0m [1m[34mSELECT pg_try_advisory_lock(1601470156486188030)[0m
|
108817
|
+
[1m[35m (0.6ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
108818
|
+
Migrating to EnablePgcryptoExtension (20181015143259)
|
108819
|
+
[1m[35m (0.2ms)[0m [1m[35mBEGIN[0m
|
108820
|
+
[1m[35mSQL (18.2ms)[0m [1m[35mCREATE EXTENSION IF NOT EXISTS "pgcrypto"[0m
|
108821
|
+
[1m[36mprimary::SchemaMigration Create (0.5ms)[0m [1m[32mINSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version"[0m [["version", "20181015143259"]]
|
108822
|
+
[1m[35m (6.1ms)[0m [1m[35mCOMMIT[0m
|
108823
|
+
Migrating to CreateKitheModels (20181015143413)
|
108824
|
+
[1m[35m (0.3ms)[0m [1m[35mBEGIN[0m
|
108825
|
+
[1m[35m (18.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)[0m
|
108826
|
+
[1m[35m (0.5ms)[0m [1m[35mALTER TABLE "kithe_models" ADD "parent_id" uuid[0m
|
108827
|
+
[1m[35m (1.1ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_parent_id" ON "kithe_models" ("parent_id")[0m
|
108828
|
+
[1m[35m (3.1ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_90130a9780"
|
108829
|
+
FOREIGN KEY ("parent_id")
|
108830
|
+
REFERENCES "kithe_models" ("id")
|
108831
|
+
[0m
|
108832
|
+
[1m[36mprimary::SchemaMigration Create (0.5ms)[0m [1m[32mINSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version"[0m [["version", "20181015143413"]]
|
108833
|
+
[1m[35m (0.5ms)[0m [1m[35mCOMMIT[0m
|
108834
|
+
Migrating to KitheModelsFriendlierId (20181015143737)
|
108835
|
+
[1m[35m (0.3ms)[0m [1m[35mBEGIN[0m
|
108836
|
+
[1m[35m (2.3ms)[0m [1m[35mCREATE OR REPLACE FUNCTION kithe_models_friendlier_id_gen(min_value bigint, max_value bigint) RETURNS text AS $$
|
108837
|
+
DECLARE
|
108838
|
+
new_id_int bigint;
|
108839
|
+
new_id_str character varying := '';
|
108840
|
+
done bool;
|
108841
|
+
tries integer;
|
108842
|
+
alphabet char[] := ARRAY['0','1','2','3','4','5','6','7','8','9',
|
108843
|
+
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
|
108844
|
+
'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
|
108845
|
+
alphabet_length integer := array_length(alphabet, 1);
|
108846
|
+
|
108847
|
+
BEGIN
|
108848
|
+
done := false;
|
108849
|
+
tries := 0;
|
108850
|
+
WHILE (NOT done) LOOP
|
108851
|
+
tries := tries + 1;
|
108852
|
+
IF (tries > 3) THEN
|
108853
|
+
RAISE 'Could not find non-conflicting friendlier_id in 3 tries';
|
108854
|
+
END IF;
|
108855
|
+
|
108856
|
+
new_id_int := trunc(random() * (max_value - min_value) + min_value);
|
108857
|
+
|
108858
|
+
-- convert bigint to a Base-36 alphanumeric string
|
108859
|
+
-- see https://web.archive.org/web/20130420084605/http://www.jamiebegin.com/base36-conversion-in-postgresql/
|
108860
|
+
-- https://gist.github.com/btbytes/7159902
|
108861
|
+
WHILE new_id_int != 0 LOOP
|
108862
|
+
new_id_str := alphabet[(new_id_int % alphabet_length)+1] || new_id_str;
|
108863
|
+
new_id_int := new_id_int / alphabet_length;
|
108864
|
+
END LOOP;
|
108865
|
+
|
108866
|
+
done := NOT exists(SELECT 1 FROM kithe_models WHERE friendlier_id=new_id_str);
|
108867
|
+
END LOOP;
|
108868
|
+
RETURN new_id_str;
|
108869
|
+
END;
|
108870
|
+
$$ LANGUAGE plpgsql;
|
108871
|
+
[0m
|
108872
|
+
[1m[35m (24.7ms)[0m [1m[35mALTER TABLE "kithe_models" ADD "friendlier_id" character varying DEFAULT kithe_models_friendlier_id_gen(2821109907456, 101559956668415) NOT NULL[0m
|
108873
|
+
[1m[35m (1.2ms)[0m [1m[35mCREATE UNIQUE INDEX "index_kithe_models_on_friendlier_id" ON "kithe_models" ("friendlier_id")[0m
|
108874
|
+
[1m[36mprimary::SchemaMigration Create (0.4ms)[0m [1m[32mINSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version"[0m [["version", "20181015143737"]]
|
108875
|
+
[1m[35m (1.2ms)[0m [1m[35mCOMMIT[0m
|
108876
|
+
Migrating to AddFileDataToModel (20181031190647)
|
108877
|
+
[1m[35m (0.4ms)[0m [1m[35mBEGIN[0m
|
108878
|
+
[1m[35m (0.4ms)[0m [1m[35mALTER TABLE "kithe_models" ADD "file_data" jsonb[0m
|
108879
|
+
[1m[36mprimary::SchemaMigration Create (0.3ms)[0m [1m[32mINSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version"[0m [["version", "20181031190647"]]
|
108880
|
+
[1m[35m (11.3ms)[0m [1m[35mCOMMIT[0m
|
108881
|
+
Migrating to CreateKitheDerivatives (20181128185658)
|
108882
|
+
[1m[35m (0.4ms)[0m [1m[35mBEGIN[0m
|
108883
|
+
[1m[35m (27.7ms)[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, CONSTRAINT "fk_rails_3dac8b4201"
|
108884
|
+
FOREIGN KEY ("asset_id")
|
108885
|
+
REFERENCES "kithe_models" ("id")
|
108886
|
+
)[0m
|
108887
|
+
[1m[35m (1.6ms)[0m [1m[35mCREATE INDEX "index_kithe_derivatives_on_asset_id" ON "kithe_derivatives" ("asset_id")[0m
|
108888
|
+
[1m[35m (1.6ms)[0m [1m[35mCREATE UNIQUE INDEX "index_kithe_derivatives_on_asset_id_and_key" ON "kithe_derivatives" ("asset_id", "key")[0m
|
108889
|
+
[1m[36mprimary::SchemaMigration Create (0.3ms)[0m [1m[32mINSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version"[0m [["version", "20181128185658"]]
|
108890
|
+
[1m[35m (0.4ms)[0m [1m[35mCOMMIT[0m
|
108891
|
+
Migrating to AddRepresentativeRelations (20190103144947)
|
108892
|
+
[1m[35m (43.7ms)[0m [1m[35mBEGIN[0m
|
108893
|
+
[1m[35m (0.4ms)[0m [1m[35mALTER TABLE "kithe_models" ADD "representative_id" uuid[0m
|
108894
|
+
[1m[35m (2.8ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_representative_id" ON "kithe_models" ("representative_id")[0m
|
108895
|
+
[1m[35m (2.5ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_afa93b7b5d"
|
108896
|
+
FOREIGN KEY ("representative_id")
|
108897
|
+
REFERENCES "kithe_models" ("id")
|
108898
|
+
[0m
|
108899
|
+
[1m[35m (0.6ms)[0m [1m[35mALTER TABLE "kithe_models" ADD "leaf_representative_id" uuid[0m
|
108900
|
+
[1m[35m (25.7ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_leaf_representative_id" ON "kithe_models" ("leaf_representative_id")[0m
|
108901
|
+
[1m[35m (12.6ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_403cce5c0d"
|
108902
|
+
FOREIGN KEY ("leaf_representative_id")
|
108903
|
+
REFERENCES "kithe_models" ("id")
|
108904
|
+
[0m
|
108905
|
+
[1m[36mprimary::SchemaMigration Create (5.1ms)[0m [1m[32mINSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version"[0m [["version", "20190103144947"]]
|
108906
|
+
[1m[35m (2.0ms)[0m [1m[35mCOMMIT[0m
|
108907
|
+
Migrating to ContainsAssociation (20190109192252)
|
108908
|
+
[1m[35m (0.9ms)[0m [1m[35mBEGIN[0m
|
108909
|
+
[1m[35m (23.6ms)[0m [1m[35mCREATE TABLE "kithe_model_contains" ("containee_id" uuid, "container_id" uuid, CONSTRAINT "fk_rails_490c1158f7"
|
108910
|
+
FOREIGN KEY ("containee_id")
|
108911
|
+
REFERENCES "kithe_models" ("id")
|
108912
|
+
, CONSTRAINT "fk_rails_091010187b"
|
108913
|
+
FOREIGN KEY ("container_id")
|
108914
|
+
REFERENCES "kithe_models" ("id")
|
108915
|
+
)[0m
|
108916
|
+
[1m[35m (1.1ms)[0m [1m[35mCREATE INDEX "index_kithe_model_contains_on_containee_id" ON "kithe_model_contains" ("containee_id")[0m
|
108917
|
+
[1m[35m (1.0ms)[0m [1m[35mCREATE INDEX "index_kithe_model_contains_on_container_id" ON "kithe_model_contains" ("container_id")[0m
|
108918
|
+
[1m[36mprimary::SchemaMigration Create (0.4ms)[0m [1m[32mINSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version"[0m [["version", "20190109192252"]]
|
108919
|
+
[1m[35m (0.4ms)[0m [1m[35mCOMMIT[0m
|
108920
|
+
Migrating to KitheModelType (20190404144551)
|
108921
|
+
[1m[35m (0.2ms)[0m [1m[35mBEGIN[0m
|
108922
|
+
[1m[35m (0.4ms)[0m [1m[35mALTER TABLE "kithe_models" ADD "kithe_model_type" integer[0m
|
108923
|
+
[1m[35m (0.4ms)[0m [1m[34mSELECT "kithe_models"."id" FROM "kithe_models" ORDER BY "kithe_models"."id" ASC LIMIT $1[0m [["LIMIT", 1000]]
|
108924
|
+
[1m[35m (0.6ms)[0m [1m[35mALTER TABLE "kithe_models" ALTER COLUMN "kithe_model_type" TYPE integer, ALTER COLUMN "kithe_model_type" SET NOT NULL[0m
|
108925
|
+
[1m[36mprimary::SchemaMigration Create (0.4ms)[0m [1m[32mINSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version"[0m [["version", "20190404144551"]]
|
108926
|
+
[1m[35m (6.4ms)[0m [1m[35mCOMMIT[0m
|
108927
|
+
[1m[36mActiveRecord::InternalMetadata Load (0.8ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", "environment"], ["LIMIT", 1]]
|
108928
|
+
[1m[35m (0.1ms)[0m [1m[35mBEGIN[0m
|
108929
|
+
[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-05-20 19:50:47.121307"], ["updated_at", "2020-05-20 19:50:47.121307"]]
|
108930
|
+
[1m[35m (0.4ms)[0m [1m[35mCOMMIT[0m
|
108931
|
+
[1m[35m (0.2ms)[0m [1m[34mSELECT pg_advisory_unlock(1601470156486188030)[0m
|
108932
|
+
[1m[35m (0.8ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
108933
|
+
[1m[35m (0.9ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
108934
|
+
[1m[35m (0.8ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
108935
|
+
[1m[35m (5.5ms)[0m [1m[34m SELECT
|
108936
|
+
pp.proname AS name,
|
108937
|
+
pg_get_functiondef(pp.oid) AS definition
|
108938
|
+
FROM pg_proc pp
|
108939
|
+
JOIN pg_namespace pn
|
108940
|
+
ON pn.oid = pp.pronamespace
|
108941
|
+
LEFT JOIN pg_depend pd
|
108942
|
+
ON pd.objid = pp.oid AND pd.deptype = 'e'
|
108943
|
+
WHERE pn.nspname = 'public' AND pd.objid IS NULL
|
108944
|
+
ORDER BY pp.oid;
|
108945
|
+
[0m
|
108946
|
+
[1m[35m (1.5ms)[0m [1m[34m SELECT
|
108947
|
+
pt.tgname AS name,
|
108948
|
+
pg_get_triggerdef(pt.oid) AS definition
|
108949
|
+
FROM pg_trigger pt
|
108950
|
+
JOIN pg_class pc
|
108951
|
+
ON (pc.oid = pt.tgrelid)
|
108952
|
+
JOIN pg_proc pp
|
108953
|
+
ON (pp.oid = pt.tgfoid)
|
108954
|
+
WHERE pt.tgname
|
108955
|
+
NOT ILIKE '%constraint%' AND pt.tgname NOT ILIKE 'pg%'
|
108956
|
+
ORDER BY pc.oid;
|
108957
|
+
[0m
|
108958
|
+
[1m[35m (0.2ms)[0m [1m[34mSELECT pg_try_advisory_lock(1601470156486188030)[0m
|
108959
|
+
[1m[35m (0.9ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
108960
|
+
[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]]
|
108961
|
+
[1m[35m (0.4ms)[0m [1m[34mSELECT pg_advisory_unlock(1601470156486188030)[0m
|
108962
|
+
[1m[35m (0.9ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
108963
|
+
[1m[35m (4.1ms)[0m [1m[34m SELECT
|
108964
|
+
pp.proname AS name,
|
108965
|
+
pg_get_functiondef(pp.oid) AS definition
|
108966
|
+
FROM pg_proc pp
|
108967
|
+
JOIN pg_namespace pn
|
108968
|
+
ON pn.oid = pp.pronamespace
|
108969
|
+
LEFT JOIN pg_depend pd
|
108970
|
+
ON pd.objid = pp.oid AND pd.deptype = 'e'
|
108971
|
+
WHERE pn.nspname = 'public' AND pd.objid IS NULL
|
108972
|
+
ORDER BY pp.oid;
|
108973
|
+
[0m
|
108974
|
+
[1m[35m (1.3ms)[0m [1m[34m SELECT
|
108975
|
+
pt.tgname AS name,
|
108976
|
+
pg_get_triggerdef(pt.oid) AS definition
|
108977
|
+
FROM pg_trigger pt
|
108978
|
+
JOIN pg_class pc
|
108979
|
+
ON (pc.oid = pt.tgrelid)
|
108980
|
+
JOIN pg_proc pp
|
108981
|
+
ON (pp.oid = pt.tgfoid)
|
108982
|
+
WHERE pt.tgname
|
108983
|
+
NOT ILIKE '%constraint%' AND pt.tgname NOT ILIKE 'pg%'
|
108984
|
+
ORDER BY pc.oid;
|
108985
|
+
[0m
|
108986
|
+
[1m[35m (0.8ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
108987
|
+
[1m[35m (0.4ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
|
108988
|
+
[1m[35m (0.3ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
108989
|
+
[1m[35m (0.2ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
|
108990
|
+
[1m[35m (0.2ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
108991
|
+
[1m[35m (0.2ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
|
108992
|
+
[1m[35m (285.0ms)[0m [1m[35mDROP DATABASE IF EXISTS "kithe_development"[0m
|
108993
|
+
[1m[35m (211.1ms)[0m [1m[35mDROP DATABASE IF EXISTS "kithe_test"[0m
|
108994
|
+
[1m[35m (491.7ms)[0m [1m[35mCREATE DATABASE "kithe_development" ENCODING = 'unicode'[0m
|
108995
|
+
[1m[35m (411.0ms)[0m [1m[35mCREATE DATABASE "kithe_test" ENCODING = 'unicode'[0m
|
108996
|
+
[1m[35mSQL (36.2ms)[0m [1m[35mCREATE EXTENSION IF NOT EXISTS "pgcrypto"[0m
|
108997
|
+
[1m[35mSQL (0.2ms)[0m [1m[35mCREATE EXTENSION IF NOT EXISTS "plpgsql"[0m
|
108998
|
+
[1m[35m (10.5ms)[0m [1m[35mCREATE OR REPLACE FUNCTION public.kithe_models_friendlier_id_gen(min_value bigint, max_value bigint)
|
108999
|
+
RETURNS text
|
109000
|
+
LANGUAGE plpgsql
|
109001
|
+
AS $function$
|
109002
|
+
DECLARE
|
109003
|
+
new_id_int bigint;
|
109004
|
+
new_id_str character varying := '';
|
109005
|
+
done bool;
|
109006
|
+
tries integer;
|
109007
|
+
alphabet char[] := ARRAY['0','1','2','3','4','5','6','7','8','9',
|
109008
|
+
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
|
109009
|
+
'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
|
109010
|
+
alphabet_length integer := array_length(alphabet, 1);
|
109011
|
+
|
109012
|
+
BEGIN
|
109013
|
+
done := false;
|
109014
|
+
tries := 0;
|
109015
|
+
WHILE (NOT done) LOOP
|
109016
|
+
tries := tries + 1;
|
109017
|
+
IF (tries > 3) THEN
|
109018
|
+
RAISE 'Could not find non-conflicting friendlier_id in 3 tries';
|
109019
|
+
END IF;
|
109020
|
+
|
109021
|
+
new_id_int := trunc(random() * (max_value - min_value) + min_value);
|
109022
|
+
|
109023
|
+
-- convert bigint to a Base-36 alphanumeric string
|
109024
|
+
-- see https://web.archive.org/web/20130420084605/http://www.jamiebegin.com/base36-conversion-in-postgresql/
|
109025
|
+
-- https://gist.github.com/btbytes/7159902
|
109026
|
+
WHILE new_id_int != 0 LOOP
|
109027
|
+
new_id_str := alphabet[(new_id_int % alphabet_length)+1] || new_id_str;
|
109028
|
+
new_id_int := new_id_int / alphabet_length;
|
109029
|
+
END LOOP;
|
109030
|
+
|
109031
|
+
done := NOT exists(SELECT 1 FROM kithe_models WHERE friendlier_id=new_id_str);
|
109032
|
+
END LOOP;
|
109033
|
+
RETURN new_id_str;
|
109034
|
+
END;
|
109035
|
+
$function$
|
109036
|
+
[0m
|
109037
|
+
[1m[35m (0.2ms)[0m [1m[35mDROP TABLE IF EXISTS "kithe_derivatives" CASCADE[0m
|
109038
|
+
[1m[35m (20.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
|
109039
|
+
[1m[35m (1.8ms)[0m [1m[35mCREATE UNIQUE INDEX "index_kithe_derivatives_on_asset_id_and_key" ON "kithe_derivatives" ("asset_id", "key")[0m
|
109040
|
+
[1m[35m (1.2ms)[0m [1m[35mCREATE INDEX "index_kithe_derivatives_on_asset_id" ON "kithe_derivatives" ("asset_id")[0m
|
109041
|
+
[1m[35m (0.2ms)[0m [1m[35mDROP TABLE IF EXISTS "kithe_model_contains" CASCADE[0m
|
109042
|
+
[1m[35m (8.4ms)[0m [1m[35mCREATE TABLE "kithe_model_contains" ("containee_id" uuid, "container_id" uuid)[0m
|
109043
|
+
[1m[35m (11.8ms)[0m [1m[35mCREATE INDEX "index_kithe_model_contains_on_containee_id" ON "kithe_model_contains" ("containee_id")[0m
|
109044
|
+
[1m[35m (1.3ms)[0m [1m[35mCREATE INDEX "index_kithe_model_contains_on_container_id" ON "kithe_model_contains" ("container_id")[0m
|
109045
|
+
[1m[35m (0.3ms)[0m [1m[35mDROP TABLE IF EXISTS "kithe_models" CASCADE[0m
|
109046
|
+
[1m[35m (4.1ms)[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
|
109047
|
+
[1m[35m (1.6ms)[0m [1m[35mCREATE UNIQUE INDEX "index_kithe_models_on_friendlier_id" ON "kithe_models" ("friendlier_id")[0m
|
109048
|
+
[1m[35m (1.4ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_leaf_representative_id" ON "kithe_models" ("leaf_representative_id")[0m
|
109049
|
+
[1m[35m (2.2ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_parent_id" ON "kithe_models" ("parent_id")[0m
|
109050
|
+
[1m[35m (1.9ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_representative_id" ON "kithe_models" ("representative_id")[0m
|
109051
|
+
[1m[35m (4.3ms)[0m [1m[35mALTER TABLE "kithe_derivatives" ADD CONSTRAINT "fk_rails_3dac8b4201"
|
109052
|
+
FOREIGN KEY ("asset_id")
|
109053
|
+
REFERENCES "kithe_models" ("id")
|
109054
|
+
[0m
|
109055
|
+
[1m[35m (2.0ms)[0m [1m[35mALTER TABLE "kithe_model_contains" ADD CONSTRAINT "fk_rails_490c1158f7"
|
109056
|
+
FOREIGN KEY ("containee_id")
|
109057
|
+
REFERENCES "kithe_models" ("id")
|
109058
|
+
[0m
|
109059
|
+
[1m[35m (2.1ms)[0m [1m[35mALTER TABLE "kithe_model_contains" ADD CONSTRAINT "fk_rails_091010187b"
|
109060
|
+
FOREIGN KEY ("container_id")
|
109061
|
+
REFERENCES "kithe_models" ("id")
|
109062
|
+
[0m
|
109063
|
+
[1m[35m (2.0ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_403cce5c0d"
|
109064
|
+
FOREIGN KEY ("leaf_representative_id")
|
109065
|
+
REFERENCES "kithe_models" ("id")
|
109066
|
+
[0m
|
109067
|
+
[1m[35m (1.8ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_90130a9780"
|
109068
|
+
FOREIGN KEY ("parent_id")
|
109069
|
+
REFERENCES "kithe_models" ("id")
|
109070
|
+
[0m
|
109071
|
+
[1m[35m (1.9ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_afa93b7b5d"
|
109072
|
+
FOREIGN KEY ("representative_id")
|
109073
|
+
REFERENCES "kithe_models" ("id")
|
109074
|
+
[0m
|
109075
|
+
[1m[35m (3.4ms)[0m [1m[35mCREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)[0m
|
109076
|
+
[1m[35m (1.2ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
109077
|
+
[1m[35m (0.9ms)[0m [1m[32mINSERT INTO "schema_migrations" (version) VALUES (20190404144551)[0m
|
109078
|
+
[1m[35m (0.8ms)[0m [1m[32mINSERT INTO "schema_migrations" (version) VALUES
|
109079
|
+
(20181015143259),
|
109080
|
+
(20181015143413),
|
109081
|
+
(20181015143737),
|
109082
|
+
(20181031190647),
|
109083
|
+
(20181128185658),
|
109084
|
+
(20190103144947),
|
109085
|
+
(20190109192252);
|
109086
|
+
|
109087
|
+
[0m
|
109088
|
+
[1m[35m (21.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
|
109089
|
+
[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]]
|
109090
|
+
[1m[35m (0.2ms)[0m [1m[35mBEGIN[0m
|
109091
|
+
[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-05-20 20:49:47.747085"], ["updated_at", "2020-05-20 20:49:47.747085"]]
|
109092
|
+
[1m[35m (0.3ms)[0m [1m[35mCOMMIT[0m
|
109093
|
+
[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]]
|
109094
|
+
[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", "schema_sha1"], ["LIMIT", 1]]
|
109095
|
+
[1m[35m (0.3ms)[0m [1m[35mBEGIN[0m
|
109096
|
+
[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", "658d6ce4e52abaa31072af6cc4edca545468d72b"], ["created_at", "2020-05-20 20:49:47.755335"], ["updated_at", "2020-05-20 20:49:47.755335"]]
|
109097
|
+
[1m[35m (0.4ms)[0m [1m[35mCOMMIT[0m
|
109098
|
+
[1m[35mSQL (11.5ms)[0m [1m[35mCREATE EXTENSION IF NOT EXISTS "pgcrypto"[0m
|
109099
|
+
[1m[35mSQL (0.2ms)[0m [1m[35mCREATE EXTENSION IF NOT EXISTS "plpgsql"[0m
|
109100
|
+
[1m[35m (2.1ms)[0m [1m[35mCREATE OR REPLACE FUNCTION public.kithe_models_friendlier_id_gen(min_value bigint, max_value bigint)
|
109101
|
+
RETURNS text
|
109102
|
+
LANGUAGE plpgsql
|
109103
|
+
AS $function$
|
109104
|
+
DECLARE
|
109105
|
+
new_id_int bigint;
|
109106
|
+
new_id_str character varying := '';
|
109107
|
+
done bool;
|
109108
|
+
tries integer;
|
109109
|
+
alphabet char[] := ARRAY['0','1','2','3','4','5','6','7','8','9',
|
109110
|
+
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
|
109111
|
+
'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
|
109112
|
+
alphabet_length integer := array_length(alphabet, 1);
|
109113
|
+
|
109114
|
+
BEGIN
|
109115
|
+
done := false;
|
109116
|
+
tries := 0;
|
109117
|
+
WHILE (NOT done) LOOP
|
109118
|
+
tries := tries + 1;
|
109119
|
+
IF (tries > 3) THEN
|
109120
|
+
RAISE 'Could not find non-conflicting friendlier_id in 3 tries';
|
109121
|
+
END IF;
|
109122
|
+
|
109123
|
+
new_id_int := trunc(random() * (max_value - min_value) + min_value);
|
109124
|
+
|
109125
|
+
-- convert bigint to a Base-36 alphanumeric string
|
109126
|
+
-- see https://web.archive.org/web/20130420084605/http://www.jamiebegin.com/base36-conversion-in-postgresql/
|
109127
|
+
-- https://gist.github.com/btbytes/7159902
|
109128
|
+
WHILE new_id_int != 0 LOOP
|
109129
|
+
new_id_str := alphabet[(new_id_int % alphabet_length)+1] || new_id_str;
|
109130
|
+
new_id_int := new_id_int / alphabet_length;
|
109131
|
+
END LOOP;
|
109132
|
+
|
109133
|
+
done := NOT exists(SELECT 1 FROM kithe_models WHERE friendlier_id=new_id_str);
|
109134
|
+
END LOOP;
|
109135
|
+
RETURN new_id_str;
|
109136
|
+
END;
|
109137
|
+
$function$
|
109138
|
+
[0m
|
109139
|
+
[1m[35m (0.3ms)[0m [1m[35mDROP TABLE IF EXISTS "kithe_derivatives" CASCADE[0m
|
109140
|
+
[1m[35m (6.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
|
109141
|
+
[1m[35m (1.9ms)[0m [1m[35mCREATE UNIQUE INDEX "index_kithe_derivatives_on_asset_id_and_key" ON "kithe_derivatives" ("asset_id", "key")[0m
|
109142
|
+
[1m[35m (1.3ms)[0m [1m[35mCREATE INDEX "index_kithe_derivatives_on_asset_id" ON "kithe_derivatives" ("asset_id")[0m
|
109143
|
+
[1m[35m (0.2ms)[0m [1m[35mDROP TABLE IF EXISTS "kithe_model_contains" CASCADE[0m
|
109144
|
+
[1m[35m (1.1ms)[0m [1m[35mCREATE TABLE "kithe_model_contains" ("containee_id" uuid, "container_id" uuid)[0m
|
109145
|
+
[1m[35m (2.5ms)[0m [1m[35mCREATE INDEX "index_kithe_model_contains_on_containee_id" ON "kithe_model_contains" ("containee_id")[0m
|
109146
|
+
[1m[35m (1.2ms)[0m [1m[35mCREATE INDEX "index_kithe_model_contains_on_container_id" ON "kithe_model_contains" ("container_id")[0m
|
109147
|
+
[1m[35m (0.2ms)[0m [1m[35mDROP TABLE IF EXISTS "kithe_models" CASCADE[0m
|
109148
|
+
[1m[35m (5.5ms)[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
|
109149
|
+
[1m[35m (1.7ms)[0m [1m[35mCREATE UNIQUE INDEX "index_kithe_models_on_friendlier_id" ON "kithe_models" ("friendlier_id")[0m
|
109150
|
+
[1m[35m (2.0ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_leaf_representative_id" ON "kithe_models" ("leaf_representative_id")[0m
|
109151
|
+
[1m[35m (1.6ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_parent_id" ON "kithe_models" ("parent_id")[0m
|
109152
|
+
[1m[35m (1.2ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_representative_id" ON "kithe_models" ("representative_id")[0m
|
109153
|
+
[1m[35m (2.9ms)[0m [1m[35mALTER TABLE "kithe_derivatives" ADD CONSTRAINT "fk_rails_3dac8b4201"
|
109154
|
+
FOREIGN KEY ("asset_id")
|
109155
|
+
REFERENCES "kithe_models" ("id")
|
109156
|
+
[0m
|
109157
|
+
[1m[35m (1.6ms)[0m [1m[35mALTER TABLE "kithe_model_contains" ADD CONSTRAINT "fk_rails_490c1158f7"
|
109158
|
+
FOREIGN KEY ("containee_id")
|
109159
|
+
REFERENCES "kithe_models" ("id")
|
109160
|
+
[0m
|
109161
|
+
[1m[35m (1.9ms)[0m [1m[35mALTER TABLE "kithe_model_contains" ADD CONSTRAINT "fk_rails_091010187b"
|
109162
|
+
FOREIGN KEY ("container_id")
|
109163
|
+
REFERENCES "kithe_models" ("id")
|
109164
|
+
[0m
|
109165
|
+
[1m[35m (2.9ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_403cce5c0d"
|
109166
|
+
FOREIGN KEY ("leaf_representative_id")
|
109167
|
+
REFERENCES "kithe_models" ("id")
|
109168
|
+
[0m
|
109169
|
+
[1m[35m (2.3ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_90130a9780"
|
109170
|
+
FOREIGN KEY ("parent_id")
|
109171
|
+
REFERENCES "kithe_models" ("id")
|
109172
|
+
[0m
|
109173
|
+
[1m[35m (2.6ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_afa93b7b5d"
|
109174
|
+
FOREIGN KEY ("representative_id")
|
109175
|
+
REFERENCES "kithe_models" ("id")
|
109176
|
+
[0m
|
109177
|
+
[1m[35m (3.7ms)[0m [1m[35mCREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)[0m
|
109178
|
+
[1m[35m (0.6ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
109179
|
+
[1m[35m (0.7ms)[0m [1m[32mINSERT INTO "schema_migrations" (version) VALUES (20190404144551)[0m
|
109180
|
+
[1m[35m (0.6ms)[0m [1m[32mINSERT INTO "schema_migrations" (version) VALUES
|
109181
|
+
(20181015143259),
|
109182
|
+
(20181015143413),
|
109183
|
+
(20181015143737),
|
109184
|
+
(20181031190647),
|
109185
|
+
(20181128185658),
|
109186
|
+
(20190103144947),
|
109187
|
+
(20190109192252);
|
109188
|
+
|
109189
|
+
[0m
|
109190
|
+
[1m[35m (3.0ms)[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
|
109191
|
+
[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]]
|
109192
|
+
[1m[35m (0.1ms)[0m [1m[35mBEGIN[0m
|
109193
|
+
[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-05-20 20:49:47.932037"], ["updated_at", "2020-05-20 20:49:47.932037"]]
|
109194
|
+
[1m[35m (0.5ms)[0m [1m[35mCOMMIT[0m
|
109195
|
+
[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]]
|
109196
|
+
[1m[35m (0.2ms)[0m [1m[35mBEGIN[0m
|
109197
|
+
[1m[36mActiveRecord::InternalMetadata Update (0.7ms)[0m [1m[33mUPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3[0m [["value", "test"], ["updated_at", "2020-05-20 20:49:47.940151"], ["key", "environment"]]
|
109198
|
+
[1m[35m (5.7ms)[0m [1m[35mCOMMIT[0m
|
109199
|
+
[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]]
|
109200
|
+
[1m[35m (0.2ms)[0m [1m[35mBEGIN[0m
|
109201
|
+
[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", "658d6ce4e52abaa31072af6cc4edca545468d72b"], ["created_at", "2020-05-20 20:49:47.953802"], ["updated_at", "2020-05-20 20:49:47.953802"]]
|
109202
|
+
[1m[35m (6.4ms)[0m [1m[35mCOMMIT[0m
|
109203
|
+
[1m[35m (7.4ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
109204
|
+
[1m[35m (30.7ms)[0m [1m[34m SELECT
|
109205
|
+
pp.proname AS name,
|
109206
|
+
pg_get_functiondef(pp.oid) AS definition
|
109207
|
+
FROM pg_proc pp
|
109208
|
+
JOIN pg_namespace pn
|
109209
|
+
ON pn.oid = pp.pronamespace
|
109210
|
+
LEFT JOIN pg_depend pd
|
109211
|
+
ON pd.objid = pp.oid AND pd.deptype = 'e'
|
109212
|
+
WHERE pn.nspname = 'public' AND pd.objid IS NULL
|
109213
|
+
ORDER BY pp.oid;
|
109214
|
+
[0m
|
109215
|
+
[1m[35m (1.8ms)[0m [1m[34m SELECT
|
109216
|
+
pt.tgname AS name,
|
109217
|
+
pg_get_triggerdef(pt.oid) AS definition
|
109218
|
+
FROM pg_trigger pt
|
109219
|
+
JOIN pg_class pc
|
109220
|
+
ON (pc.oid = pt.tgrelid)
|
109221
|
+
JOIN pg_proc pp
|
109222
|
+
ON (pp.oid = pt.tgfoid)
|
109223
|
+
WHERE pt.tgname
|
109224
|
+
NOT ILIKE '%constraint%' AND pt.tgname NOT ILIKE 'pg%'
|
109225
|
+
ORDER BY pc.oid;
|
109226
|
+
[0m
|
109227
|
+
[1m[35m (1.1ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
109228
|
+
[1m[35m (4.5ms)[0m [1m[34m SELECT
|
109229
|
+
pp.proname AS name,
|
109230
|
+
pg_get_functiondef(pp.oid) AS definition
|
109231
|
+
FROM pg_proc pp
|
109232
|
+
JOIN pg_namespace pn
|
109233
|
+
ON pn.oid = pp.pronamespace
|
109234
|
+
LEFT JOIN pg_depend pd
|
109235
|
+
ON pd.objid = pp.oid AND pd.deptype = 'e'
|
109236
|
+
WHERE pn.nspname = 'public' AND pd.objid IS NULL
|
109237
|
+
ORDER BY pp.oid;
|
109238
|
+
[0m
|
109239
|
+
[1m[35m (2.0ms)[0m [1m[34m SELECT
|
109240
|
+
pt.tgname AS name,
|
109241
|
+
pg_get_triggerdef(pt.oid) AS definition
|
109242
|
+
FROM pg_trigger pt
|
109243
|
+
JOIN pg_class pc
|
109244
|
+
ON (pc.oid = pt.tgrelid)
|
109245
|
+
JOIN pg_proc pp
|
109246
|
+
ON (pp.oid = pt.tgfoid)
|
109247
|
+
WHERE pt.tgname
|
109248
|
+
NOT ILIKE '%constraint%' AND pt.tgname NOT ILIKE 'pg%'
|
109249
|
+
ORDER BY pc.oid;
|
109250
|
+
[0m
|
109251
|
+
[1m[35m (1.1ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
109252
|
+
[1m[35m (4.2ms)[0m [1m[34m SELECT
|
109253
|
+
pp.proname AS name,
|
109254
|
+
pg_get_functiondef(pp.oid) AS definition
|
109255
|
+
FROM pg_proc pp
|
109256
|
+
JOIN pg_namespace pn
|
109257
|
+
ON pn.oid = pp.pronamespace
|
109258
|
+
LEFT JOIN pg_depend pd
|
109259
|
+
ON pd.objid = pp.oid AND pd.deptype = 'e'
|
109260
|
+
WHERE pn.nspname = 'public' AND pd.objid IS NULL
|
109261
|
+
ORDER BY pp.oid;
|
109262
|
+
[0m
|
109263
|
+
[1m[35m (1.4ms)[0m [1m[34m SELECT
|
109264
|
+
pt.tgname AS name,
|
109265
|
+
pg_get_triggerdef(pt.oid) AS definition
|
109266
|
+
FROM pg_trigger pt
|
109267
|
+
JOIN pg_class pc
|
109268
|
+
ON (pc.oid = pt.tgrelid)
|
109269
|
+
JOIN pg_proc pp
|
109270
|
+
ON (pp.oid = pt.tgfoid)
|
109271
|
+
WHERE pt.tgname
|
109272
|
+
NOT ILIKE '%constraint%' AND pt.tgname NOT ILIKE 'pg%'
|
109273
|
+
ORDER BY pc.oid;
|
109274
|
+
[0m
|
109275
|
+
[1m[35m (1.2ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
109276
|
+
[1m[35m (4.4ms)[0m [1m[34m SELECT
|
109277
|
+
pp.proname AS name,
|
109278
|
+
pg_get_functiondef(pp.oid) AS definition
|
109279
|
+
FROM pg_proc pp
|
109280
|
+
JOIN pg_namespace pn
|
109281
|
+
ON pn.oid = pp.pronamespace
|
109282
|
+
LEFT JOIN pg_depend pd
|
109283
|
+
ON pd.objid = pp.oid AND pd.deptype = 'e'
|
109284
|
+
WHERE pn.nspname = 'public' AND pd.objid IS NULL
|
109285
|
+
ORDER BY pp.oid;
|
109286
|
+
[0m
|
109287
|
+
[1m[35m (1.4ms)[0m [1m[34m SELECT
|
109288
|
+
pt.tgname AS name,
|
109289
|
+
pg_get_triggerdef(pt.oid) AS definition
|
109290
|
+
FROM pg_trigger pt
|
109291
|
+
JOIN pg_class pc
|
109292
|
+
ON (pc.oid = pt.tgrelid)
|
109293
|
+
JOIN pg_proc pp
|
109294
|
+
ON (pp.oid = pt.tgfoid)
|
109295
|
+
WHERE pt.tgname
|
109296
|
+
NOT ILIKE '%constraint%' AND pt.tgname NOT ILIKE 'pg%'
|
109297
|
+
ORDER BY pc.oid;
|
109298
|
+
[0m
|
109299
|
+
[1m[35m (0.9ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
109300
|
+
[1m[35m (4.2ms)[0m [1m[34m SELECT
|
109301
|
+
pp.proname AS name,
|
109302
|
+
pg_get_functiondef(pp.oid) AS definition
|
109303
|
+
FROM pg_proc pp
|
109304
|
+
JOIN pg_namespace pn
|
109305
|
+
ON pn.oid = pp.pronamespace
|
109306
|
+
LEFT JOIN pg_depend pd
|
109307
|
+
ON pd.objid = pp.oid AND pd.deptype = 'e'
|
109308
|
+
WHERE pn.nspname = 'public' AND pd.objid IS NULL
|
109309
|
+
ORDER BY pp.oid;
|
109310
|
+
[0m
|
109311
|
+
[1m[35m (1.3ms)[0m [1m[34m SELECT
|
109312
|
+
pt.tgname AS name,
|
109313
|
+
pg_get_triggerdef(pt.oid) AS definition
|
109314
|
+
FROM pg_trigger pt
|
109315
|
+
JOIN pg_class pc
|
109316
|
+
ON (pc.oid = pt.tgrelid)
|
109317
|
+
JOIN pg_proc pp
|
109318
|
+
ON (pp.oid = pt.tgfoid)
|
109319
|
+
WHERE pt.tgname
|
109320
|
+
NOT ILIKE '%constraint%' AND pt.tgname NOT ILIKE 'pg%'
|
109321
|
+
ORDER BY pc.oid;
|
109322
|
+
[0m
|
109323
|
+
[1m[35m (0.8ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
109324
|
+
[1m[35m (0.5ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
|
109325
|
+
[1m[35m (0.3ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
109326
|
+
[1m[35m (0.2ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
|
109327
|
+
[1m[35m (0.4ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
109328
|
+
[1m[35m (0.2ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
|
109329
|
+
[1m[35m (216.4ms)[0m [1m[35mDROP DATABASE IF EXISTS "kithe_development"[0m
|
109330
|
+
[1m[35m (228.1ms)[0m [1m[35mDROP DATABASE IF EXISTS "kithe_test"[0m
|
109331
|
+
[1m[35m (494.0ms)[0m [1m[35mCREATE DATABASE "kithe_development" ENCODING = 'unicode'[0m
|
109332
|
+
[1m[35m (422.6ms)[0m [1m[35mCREATE DATABASE "kithe_test" ENCODING = 'unicode'[0m
|
109333
|
+
[1m[35mSQL (63.2ms)[0m [1m[35mCREATE EXTENSION IF NOT EXISTS "pgcrypto"[0m
|
109334
|
+
[1m[35mSQL (50.2ms)[0m [1m[35mCREATE EXTENSION IF NOT EXISTS "plpgsql"[0m
|
109335
|
+
[1m[35m (34.8ms)[0m [1m[35mCREATE OR REPLACE FUNCTION public.kithe_models_friendlier_id_gen(min_value bigint, max_value bigint)
|
109336
|
+
RETURNS text
|
109337
|
+
LANGUAGE plpgsql
|
109338
|
+
AS $function$
|
109339
|
+
DECLARE
|
109340
|
+
new_id_int bigint;
|
109341
|
+
new_id_str character varying := '';
|
109342
|
+
done bool;
|
109343
|
+
tries integer;
|
109344
|
+
alphabet char[] := ARRAY['0','1','2','3','4','5','6','7','8','9',
|
109345
|
+
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
|
109346
|
+
'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
|
109347
|
+
alphabet_length integer := array_length(alphabet, 1);
|
109348
|
+
|
109349
|
+
BEGIN
|
109350
|
+
done := false;
|
109351
|
+
tries := 0;
|
109352
|
+
WHILE (NOT done) LOOP
|
109353
|
+
tries := tries + 1;
|
109354
|
+
IF (tries > 3) THEN
|
109355
|
+
RAISE 'Could not find non-conflicting friendlier_id in 3 tries';
|
109356
|
+
END IF;
|
109357
|
+
|
109358
|
+
new_id_int := trunc(random() * (max_value - min_value) + min_value);
|
109359
|
+
|
109360
|
+
-- convert bigint to a Base-36 alphanumeric string
|
109361
|
+
-- see https://web.archive.org/web/20130420084605/http://www.jamiebegin.com/base36-conversion-in-postgresql/
|
109362
|
+
-- https://gist.github.com/btbytes/7159902
|
109363
|
+
WHILE new_id_int != 0 LOOP
|
109364
|
+
new_id_str := alphabet[(new_id_int % alphabet_length)+1] || new_id_str;
|
109365
|
+
new_id_int := new_id_int / alphabet_length;
|
109366
|
+
END LOOP;
|
109367
|
+
|
109368
|
+
done := NOT exists(SELECT 1 FROM kithe_models WHERE friendlier_id=new_id_str);
|
109369
|
+
END LOOP;
|
109370
|
+
RETURN new_id_str;
|
109371
|
+
END;
|
109372
|
+
$function$
|
109373
|
+
[0m
|
109374
|
+
[1m[35m (0.4ms)[0m [1m[35mDROP TABLE IF EXISTS "kithe_derivatives" CASCADE[0m
|
109375
|
+
[1m[35m (12.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
|
109376
|
+
[1m[35m (2.0ms)[0m [1m[35mCREATE UNIQUE INDEX "index_kithe_derivatives_on_asset_id_and_key" ON "kithe_derivatives" ("asset_id", "key")[0m
|
109377
|
+
[1m[35m (1.5ms)[0m [1m[35mCREATE INDEX "index_kithe_derivatives_on_asset_id" ON "kithe_derivatives" ("asset_id")[0m
|
109378
|
+
[1m[35m (0.2ms)[0m [1m[35mDROP TABLE IF EXISTS "kithe_model_contains" CASCADE[0m
|
109379
|
+
[1m[35m (1.1ms)[0m [1m[35mCREATE TABLE "kithe_model_contains" ("containee_id" uuid, "container_id" uuid)[0m
|
109380
|
+
[1m[35m (1.1ms)[0m [1m[35mCREATE INDEX "index_kithe_model_contains_on_containee_id" ON "kithe_model_contains" ("containee_id")[0m
|
109381
|
+
[1m[35m (1.3ms)[0m [1m[35mCREATE INDEX "index_kithe_model_contains_on_container_id" ON "kithe_model_contains" ("container_id")[0m
|
109382
|
+
[1m[35m (0.4ms)[0m [1m[35mDROP TABLE IF EXISTS "kithe_models" CASCADE[0m
|
109383
|
+
[1m[35m (4.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
|
109384
|
+
[1m[35m (1.3ms)[0m [1m[35mCREATE UNIQUE INDEX "index_kithe_models_on_friendlier_id" ON "kithe_models" ("friendlier_id")[0m
|
109385
|
+
[1m[35m (1.3ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_leaf_representative_id" ON "kithe_models" ("leaf_representative_id")[0m
|
109386
|
+
[1m[35m (1.1ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_parent_id" ON "kithe_models" ("parent_id")[0m
|
109387
|
+
[1m[35m (1.1ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_representative_id" ON "kithe_models" ("representative_id")[0m
|
109388
|
+
[1m[35m (3.2ms)[0m [1m[35mALTER TABLE "kithe_derivatives" ADD CONSTRAINT "fk_rails_3dac8b4201"
|
109389
|
+
FOREIGN KEY ("asset_id")
|
109390
|
+
REFERENCES "kithe_models" ("id")
|
109391
|
+
[0m
|
109392
|
+
[1m[35m (2.3ms)[0m [1m[35mALTER TABLE "kithe_model_contains" ADD CONSTRAINT "fk_rails_490c1158f7"
|
109393
|
+
FOREIGN KEY ("containee_id")
|
109394
|
+
REFERENCES "kithe_models" ("id")
|
109395
|
+
[0m
|
109396
|
+
[1m[35m (1.7ms)[0m [1m[35mALTER TABLE "kithe_model_contains" ADD CONSTRAINT "fk_rails_091010187b"
|
109397
|
+
FOREIGN KEY ("container_id")
|
109398
|
+
REFERENCES "kithe_models" ("id")
|
109399
|
+
[0m
|
109400
|
+
[1m[35m (1.6ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_403cce5c0d"
|
109401
|
+
FOREIGN KEY ("leaf_representative_id")
|
109402
|
+
REFERENCES "kithe_models" ("id")
|
109403
|
+
[0m
|
109404
|
+
[1m[35m (1.7ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_90130a9780"
|
109405
|
+
FOREIGN KEY ("parent_id")
|
109406
|
+
REFERENCES "kithe_models" ("id")
|
109407
|
+
[0m
|
109408
|
+
[1m[35m (1.7ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_afa93b7b5d"
|
109409
|
+
FOREIGN KEY ("representative_id")
|
109410
|
+
REFERENCES "kithe_models" ("id")
|
109411
|
+
[0m
|
109412
|
+
[1m[35m (7.6ms)[0m [1m[35mCREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)[0m
|
109413
|
+
[1m[35m (0.7ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
109414
|
+
[1m[35m (0.7ms)[0m [1m[32mINSERT INTO "schema_migrations" (version) VALUES (20190404144551)[0m
|
109415
|
+
[1m[35m (0.6ms)[0m [1m[32mINSERT INTO "schema_migrations" (version) VALUES
|
109416
|
+
(20181015143259),
|
109417
|
+
(20181015143413),
|
109418
|
+
(20181015143737),
|
109419
|
+
(20181031190647),
|
109420
|
+
(20181128185658),
|
109421
|
+
(20190103144947),
|
109422
|
+
(20190109192252);
|
109423
|
+
|
109424
|
+
[0m
|
109425
|
+
[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
|
109426
|
+
[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]]
|
109427
|
+
[1m[35m (0.2ms)[0m [1m[35mBEGIN[0m
|
109428
|
+
[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-05-20 21:22:55.681291"], ["updated_at", "2020-05-20 21:22:55.681291"]]
|
109429
|
+
[1m[35m (0.5ms)[0m [1m[35mCOMMIT[0m
|
109430
|
+
[1m[36mActiveRecord::InternalMetadata Load (0.2ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", "environment"], ["LIMIT", 1]]
|
109431
|
+
[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]]
|
109432
|
+
[1m[35m (0.1ms)[0m [1m[35mBEGIN[0m
|
109433
|
+
[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-20 21:22:55.690278"], ["updated_at", "2020-05-20 21:22:55.690278"]]
|
109434
|
+
[1m[35m (0.5ms)[0m [1m[35mCOMMIT[0m
|
109435
|
+
[1m[35mSQL (10.7ms)[0m [1m[35mCREATE EXTENSION IF NOT EXISTS "pgcrypto"[0m
|
109436
|
+
[1m[35mSQL (0.2ms)[0m [1m[35mCREATE EXTENSION IF NOT EXISTS "plpgsql"[0m
|
109437
|
+
[1m[35m (2.1ms)[0m [1m[35mCREATE OR REPLACE FUNCTION public.kithe_models_friendlier_id_gen(min_value bigint, max_value bigint)
|
109438
|
+
RETURNS text
|
109439
|
+
LANGUAGE plpgsql
|
109440
|
+
AS $function$
|
109441
|
+
DECLARE
|
109442
|
+
new_id_int bigint;
|
109443
|
+
new_id_str character varying := '';
|
109444
|
+
done bool;
|
109445
|
+
tries integer;
|
109446
|
+
alphabet char[] := ARRAY['0','1','2','3','4','5','6','7','8','9',
|
109447
|
+
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
|
109448
|
+
'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
|
109449
|
+
alphabet_length integer := array_length(alphabet, 1);
|
109450
|
+
|
109451
|
+
BEGIN
|
109452
|
+
done := false;
|
109453
|
+
tries := 0;
|
109454
|
+
WHILE (NOT done) LOOP
|
109455
|
+
tries := tries + 1;
|
109456
|
+
IF (tries > 3) THEN
|
109457
|
+
RAISE 'Could not find non-conflicting friendlier_id in 3 tries';
|
109458
|
+
END IF;
|
109459
|
+
|
109460
|
+
new_id_int := trunc(random() * (max_value - min_value) + min_value);
|
109461
|
+
|
109462
|
+
-- convert bigint to a Base-36 alphanumeric string
|
109463
|
+
-- see https://web.archive.org/web/20130420084605/http://www.jamiebegin.com/base36-conversion-in-postgresql/
|
109464
|
+
-- https://gist.github.com/btbytes/7159902
|
109465
|
+
WHILE new_id_int != 0 LOOP
|
109466
|
+
new_id_str := alphabet[(new_id_int % alphabet_length)+1] || new_id_str;
|
109467
|
+
new_id_int := new_id_int / alphabet_length;
|
109468
|
+
END LOOP;
|
109469
|
+
|
109470
|
+
done := NOT exists(SELECT 1 FROM kithe_models WHERE friendlier_id=new_id_str);
|
109471
|
+
END LOOP;
|
109472
|
+
RETURN new_id_str;
|
109473
|
+
END;
|
109474
|
+
$function$
|
109475
|
+
[0m
|
109476
|
+
[1m[35m (0.2ms)[0m [1m[35mDROP TABLE IF EXISTS "kithe_derivatives" CASCADE[0m
|
109477
|
+
[1m[35m (6.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
|
109478
|
+
[1m[35m (1.7ms)[0m [1m[35mCREATE UNIQUE INDEX "index_kithe_derivatives_on_asset_id_and_key" ON "kithe_derivatives" ("asset_id", "key")[0m
|
109479
|
+
[1m[35m (1.2ms)[0m [1m[35mCREATE INDEX "index_kithe_derivatives_on_asset_id" ON "kithe_derivatives" ("asset_id")[0m
|
109480
|
+
[1m[35m (0.2ms)[0m [1m[35mDROP TABLE IF EXISTS "kithe_model_contains" CASCADE[0m
|
109481
|
+
[1m[35m (1.0ms)[0m [1m[35mCREATE TABLE "kithe_model_contains" ("containee_id" uuid, "container_id" uuid)[0m
|
109482
|
+
[1m[35m (1.7ms)[0m [1m[35mCREATE INDEX "index_kithe_model_contains_on_containee_id" ON "kithe_model_contains" ("containee_id")[0m
|
109483
|
+
[1m[35m (1.3ms)[0m [1m[35mCREATE INDEX "index_kithe_model_contains_on_container_id" ON "kithe_model_contains" ("container_id")[0m
|
109484
|
+
[1m[35m (0.2ms)[0m [1m[35mDROP TABLE IF EXISTS "kithe_models" CASCADE[0m
|
109485
|
+
[1m[35m (3.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
|
109486
|
+
[1m[35m (1.2ms)[0m [1m[35mCREATE UNIQUE INDEX "index_kithe_models_on_friendlier_id" ON "kithe_models" ("friendlier_id")[0m
|
109487
|
+
[1m[35m (1.2ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_leaf_representative_id" ON "kithe_models" ("leaf_representative_id")[0m
|
109488
|
+
[1m[35m (1.4ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_parent_id" ON "kithe_models" ("parent_id")[0m
|
109489
|
+
[1m[35m (1.2ms)[0m [1m[35mCREATE INDEX "index_kithe_models_on_representative_id" ON "kithe_models" ("representative_id")[0m
|
109490
|
+
[1m[35m (2.8ms)[0m [1m[35mALTER TABLE "kithe_derivatives" ADD CONSTRAINT "fk_rails_3dac8b4201"
|
109491
|
+
FOREIGN KEY ("asset_id")
|
109492
|
+
REFERENCES "kithe_models" ("id")
|
109493
|
+
[0m
|
109494
|
+
[1m[35m (1.8ms)[0m [1m[35mALTER TABLE "kithe_model_contains" ADD CONSTRAINT "fk_rails_490c1158f7"
|
109495
|
+
FOREIGN KEY ("containee_id")
|
109496
|
+
REFERENCES "kithe_models" ("id")
|
109497
|
+
[0m
|
109498
|
+
[1m[35m (1.5ms)[0m [1m[35mALTER TABLE "kithe_model_contains" ADD CONSTRAINT "fk_rails_091010187b"
|
109499
|
+
FOREIGN KEY ("container_id")
|
109500
|
+
REFERENCES "kithe_models" ("id")
|
109501
|
+
[0m
|
109502
|
+
[1m[35m (2.1ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_403cce5c0d"
|
109503
|
+
FOREIGN KEY ("leaf_representative_id")
|
109504
|
+
REFERENCES "kithe_models" ("id")
|
109505
|
+
[0m
|
109506
|
+
[1m[35m (1.8ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_90130a9780"
|
109507
|
+
FOREIGN KEY ("parent_id")
|
109508
|
+
REFERENCES "kithe_models" ("id")
|
109509
|
+
[0m
|
109510
|
+
[1m[35m (1.8ms)[0m [1m[35mALTER TABLE "kithe_models" ADD CONSTRAINT "fk_rails_afa93b7b5d"
|
109511
|
+
FOREIGN KEY ("representative_id")
|
109512
|
+
REFERENCES "kithe_models" ("id")
|
109513
|
+
[0m
|
109514
|
+
[1m[35m (3.0ms)[0m [1m[35mCREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)[0m
|
109515
|
+
[1m[35m (0.7ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
109516
|
+
[1m[35m (1.1ms)[0m [1m[32mINSERT INTO "schema_migrations" (version) VALUES (20190404144551)[0m
|
109517
|
+
[1m[35m (0.6ms)[0m [1m[32mINSERT INTO "schema_migrations" (version) VALUES
|
109518
|
+
(20181015143259),
|
109519
|
+
(20181015143413),
|
109520
|
+
(20181015143737),
|
109521
|
+
(20181031190647),
|
109522
|
+
(20181128185658),
|
109523
|
+
(20190103144947),
|
109524
|
+
(20190109192252);
|
109525
|
+
|
109526
|
+
[0m
|
109527
|
+
[1m[35m (2.9ms)[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
|
109528
|
+
[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]]
|
109529
|
+
[1m[35m (0.1ms)[0m [1m[35mBEGIN[0m
|
109530
|
+
[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-05-20 21:22:55.842211"], ["updated_at", "2020-05-20 21:22:55.842211"]]
|
109531
|
+
[1m[35m (0.4ms)[0m [1m[35mCOMMIT[0m
|
109532
|
+
[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]]
|
109533
|
+
[1m[35m (0.1ms)[0m [1m[35mBEGIN[0m
|
109534
|
+
[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-05-20 21:22:55.848684"], ["key", "environment"]]
|
109535
|
+
[1m[35m (0.3ms)[0m [1m[35mCOMMIT[0m
|
109536
|
+
[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]]
|
109537
|
+
[1m[35m (0.1ms)[0m [1m[35mBEGIN[0m
|
109538
|
+
[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-20 21:22:55.854305"], ["updated_at", "2020-05-20 21:22:55.854305"]]
|
109539
|
+
[1m[35m (0.4ms)[0m [1m[35mCOMMIT[0m
|