1 CREATE TABLE reference_types (
2 reference_type_id integer NOT NULL generated by default as identity (start with 100, increment by 1, no cache),
3 type_label varchar(50) default NULL,
4 abbreviation varchar(50) default NULL,
5 description varchar(50) default NULL,
6 PRIMARY KEY (reference_type_id)
9 CREATE TABLE reference_codes (
10 reference_type_id integer,
11 reference_code integer NOT NULL,
12 code_label varchar(50) default NULL,
13 abbreviation varchar(50) default NULL,
14 description varchar(50) default NULL,
15 PRIMARY KEY (reference_type_id,reference_code)
18 CREATE TABLE products (
20 name varchar(50) default NULL,
24 CREATE TABLE tariffs (
25 tariff_id integer NOT NULL,
26 start_date date NOT NULL,
27 amount integer default NULL,
28 PRIMARY KEY (tariff_id,start_date)
31 CREATE TABLE product_tariffs (
32 product_id integer NOT NULL,
33 tariff_id integer NOT NULL,
34 tariff_start_date date NOT NULL,
35 PRIMARY KEY (product_id,tariff_id,tariff_start_date)
38 CREATE TABLE suburbs (
39 city_id integer NOT NULL,
40 suburb_id integer NOT NULL,
41 name varchar(50) NOT NULL,
42 PRIMARY KEY (city_id,suburb_id)
45 CREATE TABLE streets (
47 city_id integer NOT NULL,
48 suburb_id integer NOT NULL,
49 name varchar(50) NOT NULL,
55 name varchar(50) NOT NULL,
59 CREATE TABLE articles (
61 name varchar(50) NOT NULL,
65 CREATE TABLE readings (
67 user_id integer NOT NULL,
68 article_id integer NOT NULL,
69 rating integer NOT NULL,
75 name varchar(50) NOT NULL,
79 CREATE TABLE memberships (
80 user_id integer NOT NULL,
81 group_id integer NOT NULL,
82 PRIMARY KEY (user_id,group_id)
85 CREATE TABLE membership_statuses (
87 user_id integer NOT NULL,
88 group_id integer NOT NULL,
89 status varchar(50) NOT NULL,
93 create table kitchen_sinks (
94 id_1 integer not null,
95 id_2 integer not null,
97 a_string varchar(100),
98 primary key (id_1, id_2)
101 create table restaurants (
102 franchise_id integer not null,
103 store_id integer not null,
105 primary key (franchise_id, store_id)
108 create table restaurants_suburbs (
109 franchise_id integer not null,
110 store_id integer not null,
111 city_id integer not null,
112 suburb_id integer not null