-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ (migrations): Simplify shopifyDomain table structure, use domain as PK
📝 (migrations): Update comments to reflect changes in shopifyDomain table ✨ (GraphQL): Add query for fetching Shopify domain by PK ✅ (tests): Add tests for new Shopify domain query and error handling ♻️ (Shopify handler): Refactor to include organizerId in request validation response
- Loading branch information
1 parent
5adf4c0
commit c35638d
Showing
10 changed files
with
11,693 additions
and
6,743 deletions.
There are no files selected for viewing
24 changes: 4 additions & 20 deletions
24
hasura/app/migrations/default/1713432670329_shopifyDomain/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,17 @@ | ||
-- Could not auto-generate a down migration. | ||
-- Please write an appropriate down migration for the SQL below: | ||
-- -- Create the shopifyDomain table | ||
-- CREATE TABLE "public"."shopifyDomain" ( | ||
-- id uuid DEFAULT gen_random_uuid() NOT NULL, | ||
-- domain text NOT NULL, | ||
-- CREATE TABLE "public"."shopifyDomain"( | ||
-- domain text PRIMARY KEY, | ||
-- "organizerId" text NOT NULL, | ||
-- created_at timestamp with time zone DEFAULT now(), | ||
-- updated_at timestamp with time zone DEFAULT now(), | ||
-- PRIMARY KEY (id) | ||
-- created_at timestamp with time zone DEFAULT now() | ||
-- ); | ||
-- | ||
-- -- Create a unique index on the domain column for optimized querying | ||
-- CREATE UNIQUE INDEX idx_shopify_domain_unique_domain ON "public"."shopifyDomain" (domain); | ||
-- | ||
-- -- Comments on the purpose of the shopifyDomain table and its fields | ||
-- COMMENT ON TABLE "public"."shopifyDomain" IS E'This table is used to link and authenticate queries from Shopify to an organizer in our system. It stores the unique Shopify domains associated with each organizer, allowing for efficient lookup and validation of incoming requests.'; | ||
-- | ||
-- COMMENT ON COLUMN "public"."shopifyDomain"."id" IS E'Unique identifier for each Shopify domain entry, generated automatically as a UUID.'; | ||
-- | ||
-- COMMENT ON COLUMN "public"."shopifyDomain"."domain" IS E'The Shopify domain value, which must be unique across the entire table to ensure accurate mapping between Shopify and our system.'; | ||
-- COMMENT ON COLUMN "public"."shopifyDomain"."domain" IS E'The Shopify domain value, which serves as the primary key for the table, ensuring uniqueness across all records.'; | ||
-- | ||
-- COMMENT ON COLUMN "public"."shopifyDomain"."organizerId" IS E'The unique identifier of the associated organizer in our external CRM system. This field is used to link Shopify domains to the corresponding organizers.'; | ||
-- | ||
-- COMMENT ON COLUMN "public"."shopifyDomain"."created_at" IS E'Timestamp indicating when the record was initially created, set automatically by the system.'; | ||
-- | ||
-- COMMENT ON COLUMN "public"."shopifyDomain"."updated_at" IS E'Timestamp indicating the last time the record was updated, automatically managed by a database trigger to ensure accuracy.'; | ||
-- | ||
-- -- Create trigger for updating the updated_at field in the shopifyDomain table | ||
-- CREATE TRIGGER set_public_shopify_domain_updated_at | ||
-- BEFORE UPDATE ON "public"."shopifyDomain" | ||
-- FOR EACH ROW | ||
-- EXECUTE FUNCTION public.set_current_timestamp_updated_at(); |
23 changes: 4 additions & 19 deletions
23
hasura/app/migrations/default/1713432670329_shopifyDomain/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,16 @@ | ||
-- Create the shopifyDomain table | ||
CREATE TABLE "public"."shopifyDomain" ( | ||
id uuid DEFAULT gen_random_uuid() NOT NULL, | ||
domain text NOT NULL, | ||
CREATE TABLE "public"."shopifyDomain"( | ||
domain text PRIMARY KEY, | ||
"organizerId" text NOT NULL, | ||
created_at timestamp with time zone DEFAULT now(), | ||
updated_at timestamp with time zone DEFAULT now(), | ||
PRIMARY KEY (id) | ||
created_at timestamp with time zone DEFAULT now() | ||
); | ||
|
||
-- Create a unique index on the domain column for optimized querying | ||
CREATE UNIQUE INDEX idx_shopify_domain_unique_domain ON "public"."shopifyDomain" (domain); | ||
|
||
-- Comments on the purpose of the shopifyDomain table and its fields | ||
COMMENT ON TABLE "public"."shopifyDomain" IS E'This table is used to link and authenticate queries from Shopify to an organizer in our system. It stores the unique Shopify domains associated with each organizer, allowing for efficient lookup and validation of incoming requests.'; | ||
|
||
COMMENT ON COLUMN "public"."shopifyDomain"."id" IS E'Unique identifier for each Shopify domain entry, generated automatically as a UUID.'; | ||
|
||
COMMENT ON COLUMN "public"."shopifyDomain"."domain" IS E'The Shopify domain value, which must be unique across the entire table to ensure accurate mapping between Shopify and our system.'; | ||
COMMENT ON COLUMN "public"."shopifyDomain"."domain" IS E'The Shopify domain value, which serves as the primary key for the table, ensuring uniqueness across all records.'; | ||
|
||
COMMENT ON COLUMN "public"."shopifyDomain"."organizerId" IS E'The unique identifier of the associated organizer in our external CRM system. This field is used to link Shopify domains to the corresponding organizers.'; | ||
|
||
COMMENT ON COLUMN "public"."shopifyDomain"."created_at" IS E'Timestamp indicating when the record was initially created, set automatically by the system.'; | ||
|
||
COMMENT ON COLUMN "public"."shopifyDomain"."updated_at" IS E'Timestamp indicating the last time the record was updated, automatically managed by a database trigger to ensure accuracy.'; | ||
|
||
-- Create trigger for updating the updated_at field in the shopifyDomain table | ||
CREATE TRIGGER set_public_shopify_domain_updated_at | ||
BEFORE UPDATE ON "public"."shopifyDomain" | ||
FOR EACH ROW | ||
EXECUTE FUNCTION public.set_current_timestamp_updated_at(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.