changed device.geography table and device.preferences table to have references to geography schema tables
parent
c851624256
commit
e5838736ab
|
@ -1,13 +1,28 @@
|
|||
-- Account level preferences that pertain to device function.
|
||||
CREATE TABLE device.account_preferences (
|
||||
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
account_id uuid REFERENCES account.account ON DELETE CASCADE,
|
||||
date_format date_format_enum NOT NULL DEFAULT 'MM/DD/YYYY',
|
||||
time_format time_format_enum NOT NULL DEFAULT '12 Hour',
|
||||
measurement_system measurement_system_enum NOT NULL DEFAULT 'Imperial',
|
||||
wake_word_id uuid NOT NULL REFERENCES device.wake_word,
|
||||
text_to_speech_id uuid NOT NULL REFERENCES device.text_to_speech,
|
||||
geography_id uuid REFERENCES device.geography,
|
||||
insert_ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
id uuid PRIMARY KEY
|
||||
DEFAULT gen_random_uuid(),
|
||||
account_id uuid NOT NULL
|
||||
REFERENCES account.account ON DELETE CASCADE,
|
||||
date_format date_format_enum NOT NULL
|
||||
DEFAULT 'MM/DD/YYYY',
|
||||
time_format time_format_enum NOT NULL
|
||||
DEFAULT '12 Hour',
|
||||
measurement_system measurement_system_enum NOT NULL
|
||||
DEFAULT 'Imperial',
|
||||
wake_word_id uuid
|
||||
REFERENCES device.wake_word,
|
||||
text_to_speech_id uuid
|
||||
REFERENCES device.text_to_speech,
|
||||
country_id uuid
|
||||
REFERENCES geography.country,
|
||||
region_id uuid
|
||||
REFERENCES geography.region,
|
||||
city_id uuid
|
||||
REFERENCES geography.city,
|
||||
timezone_id uuid
|
||||
REFERENCES geography.timezone,
|
||||
insert_ts TIMESTAMP NOT NULL
|
||||
DEFAULT CURRENT_TIMESTAMP
|
||||
|
||||
);
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
CREATE TABLE device.geography (
|
||||
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
account_id uuid NOT NULL REFERENCES account.account ON DELETE CASCADE,
|
||||
country text NOT NULL,
|
||||
state text NOT NULL,
|
||||
city text NOT NULL,
|
||||
time_zone text,
|
||||
latitude NUMERIC NOT NULL,
|
||||
longitude NUMERIC NOT NULL,
|
||||
insert_ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
UNIQUE (account_id, latitude, longitude)
|
||||
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
account_id uuid NOT NULL
|
||||
REFERENCES account.account ON DELETE CASCADE,
|
||||
country_id uuid NOT NULL
|
||||
REFERENCES geography.country,
|
||||
region_id uuid NOT NULL
|
||||
REFERENCES geography.region,
|
||||
city_id uuid NOT NULL
|
||||
REFERENCES geography.city,
|
||||
timezone_id uuid NOT NULL
|
||||
REFERENCES geography.timezone,
|
||||
insert_ts TIMESTAMP NOT NULL
|
||||
DEFAULT CURRENT_TIMESTAMP,
|
||||
UNIQUE (account_id, country_id, region_id, city_id, timezone_id)
|
||||
);
|
||||
|
|
|
@ -127,10 +127,10 @@ for table in SKILL_TABLE_ORDER:
|
|||
get_sql_from_file(create_table_file)
|
||||
)
|
||||
|
||||
print('Creating the device schema tables')
|
||||
for table in DEVICE_TABLE_ORDER:
|
||||
print('Creating the geography schema tables')
|
||||
for table in GEOGRAPHY_TABLE_ORDER:
|
||||
create_table_file = path.join(
|
||||
'device_schema',
|
||||
'geography_schema',
|
||||
'tables',
|
||||
table + '.sql'
|
||||
)
|
||||
|
@ -138,10 +138,10 @@ for table in DEVICE_TABLE_ORDER:
|
|||
get_sql_from_file(create_table_file)
|
||||
)
|
||||
|
||||
print('Creating the geography schema tables')
|
||||
for table in GEOGRAPHY_TABLE_ORDER:
|
||||
print('Creating the device schema tables')
|
||||
for table in DEVICE_TABLE_ORDER:
|
||||
create_table_file = path.join(
|
||||
'geography_schema',
|
||||
'device_schema',
|
||||
'tables',
|
||||
table + '.sql'
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue