16 lines
624 B
SQL
16 lines
624 B
SQL
-- colon before variable: for a prepared statement using named placeholders, this will be a parameter name of the form :name
|
|
|
|
CREATE SCHEMA IF NOT EXISTS :schema;
|
|
SET search_path to :schema, public;
|
|
|
|
-- create table
|
|
DROP TABLE IF EXISTS :schema.services CASCADE;
|
|
CREATE TABLE IF NOT EXISTS :schema.services
|
|
(
|
|
feed_index int NOT NULL REFERENCES feed_info (feed_index) ON DELETE CASCADE,
|
|
service_id text NOT NULL,
|
|
dates text NOT NULL,
|
|
CONSTRAINT services_service_id_fkey FOREIGN KEY (feed_index, service_id) REFERENCES :schema.calendar(feed_index, service_id),
|
|
CONSTRAINT services_pkey PRIMARY KEY (feed_index, service_id)
|
|
);
|