ability to mock stores stubbed
This commit is contained in:
@@ -138,6 +138,16 @@ CREATE TABLE mock.shop_ebay (
|
||||
FOREIGN KEY (account_id, user_id) REFERENCES mock.accounts (account_id, user_id)
|
||||
);
|
||||
|
||||
CREATE TABLE mock.shop_etsy (
|
||||
user_id TEXT NOT NULL REFERENCES oauth_users (user_id),
|
||||
account_id INTEGER NOT NULL REFERENCES mock.accounts (account_id),
|
||||
shop_id TEXT NOT NULL,
|
||||
name TEXT NOT NULL CHECK (char_length(name) > 0),
|
||||
|
||||
PRIMARY KEY (account_id, shop_id),
|
||||
FOREIGN KEY (account_id, user_id) REFERENCES mock.accounts (account_id, user_id)
|
||||
);
|
||||
|
||||
|
||||
-- mock sync group listings
|
||||
|
||||
@@ -467,6 +477,32 @@ CREATE TABLE mock.shop_ebay_sync_group_listings (
|
||||
FOREIGN KEY (shop_id, listing_id) REFERENCES mock.shop_ebay_listings (shop_id, listing_id)
|
||||
);
|
||||
|
||||
-- mock etsy sync group listings
|
||||
|
||||
CREATE TABLE mock.shop_etsy_listings (
|
||||
account_id INTEGER NOT NULL REFERENCES mock.accounts (account_id),
|
||||
shop_id TEXT NOT NULL,
|
||||
listing_id TEXT NOT NULL,
|
||||
name TEXT NOT NULL,
|
||||
|
||||
PRIMARY KEY (shop_id, listing_id),
|
||||
FOREIGN KEY (account_id, shop_id) REFERENCES mock.shop_etsy (account_id, shop_id)
|
||||
);
|
||||
|
||||
CREATE TABLE mock.shop_etsy_sync_group_listings (
|
||||
account_id INTEGER NOT NULL REFERENCES mock.accounts (account_id),
|
||||
sync_group_id INTEGER NOT NULL REFERENCES mock.sync_groups (sync_group_id),
|
||||
shop_id TEXT NOT NULL,
|
||||
listing_id TEXT NOT NULL,
|
||||
order_index INTEGER NOT NULL,
|
||||
|
||||
-- allow each shop to have at most ONE listing per sync group
|
||||
UNIQUE (sync_group_id, shop_id),
|
||||
FOREIGN KEY (account_id, shop_id) REFERENCES mock.shop_etsy (account_id, shop_id),
|
||||
FOREIGN KEY (sync_group_id, order_index) REFERENCES mock.sync_group_listing_order_indexes (sync_group_id, order_index),
|
||||
FOREIGN KEY (shop_id, listing_id) REFERENCES mock.shop_etsy_listings (shop_id, listing_id)
|
||||
);
|
||||
|
||||
|
||||
|
||||
GRANT ALL ON SCHEMA mock TO PUBLIC;
|
||||
|
||||
Reference in New Issue
Block a user