CREATE TABLE tiktok_store_events (
	platform			TEXT 			NOT NULL DEFAULT 'tiktok' CHECK (platform = 'tiktok'),
	store_id			TEXT 			NOT NULL,
	event_timestamp		TIMESTAMPTZ 	NOT NULL,
	event_id			TEXT 			NOT NULL,

	PRIMARY KEY (store_id, event_id, event_timestamp),
	FOREIGN KEY (platform, store_id, event_id, event_timestamp) REFERENCES raw_store_events
);

CREATE TABLE etsy_store_events (
	platform			TEXT 			NOT NULL DEFAULT 'etsy' CHECK (platform = 'etsy'),
	store_id			TEXT 			NOT NULL,
	event_timestamp		TIMESTAMPTZ 	NOT NULL,
	event_id			TEXT 			NOT NULL,

	PRIMARY KEY (store_id, event_id, event_timestamp),
	FOREIGN KEY (platform, store_id, event_id, event_timestamp) REFERENCES raw_store_events
);

CREATE TABLE wix_store_events (
	platform			TEXT 			NOT NULL DEFAULT 'wix' CHECK (platform = 'wix'),
	store_id			TEXT 			NOT NULL,
	event_timestamp		TIMESTAMPTZ 	NOT NULL,
	event_id			TEXT 			NOT NULL,

	PRIMARY KEY (store_id, event_id, event_timestamp),
	FOREIGN KEY (platform, store_id, event_id, event_timestamp) REFERENCES raw_store_events
);
