| 1 |
BEGIN TRANSACTION; |
| 2 |
CREATE TABLE machine (machine_id Integer PRIMARY KEY NOT NULL, |
| 3 |
address Text); |
| 4 |
INSERT INTO "machine" VALUES(1,'127.0.0.1'); |
| 5 |
CREATE TABLE content_type (type_id integer PRIMARY KEY NOT NULL, |
| 6 |
name varchar NOT NULL); |
| 7 |
INSERT INTO "content_type" VALUES(1,'dollar'); |
| 8 |
INSERT INTO "content_type" VALUES(2,'quarter'); |
| 9 |
INSERT INTO "content_type" VALUES(3,'dime'); |
| 10 |
INSERT INTO "content_type" VALUES(4,'nickel'); |
| 11 |
INSERT INTO "content_type" VALUES(9,'shilling'); |
| 12 |
INSERT INTO "content_type" VALUES(11,'diamond'); |
| 13 |
CREATE TABLE coin (coin_id integer PRIMARY KEY NOT NULL REFERENCES content(content_id), |
| 14 |
type_id integer NOT NULL REFERENCES content_type(type_id)); |
| 15 |
INSERT INTO "coin" VALUES(130,1); |
| 16 |
INSERT INTO "coin" VALUES(131,1); |
| 17 |
INSERT INTO "coin" VALUES(132,1); |
| 18 |
INSERT INTO "coin" VALUES(133,1); |
| 19 |
INSERT INTO "coin" VALUES(134,1); |
| 20 |
INSERT INTO "coin" VALUES(135,1); |
| 21 |
CREATE TABLE product (product_id integer PRIMARY KEY NOT NULL REFERENCES content_type(type_id), |
| 22 |
cost_cents integer NOT NULL, |
| 23 |
manufacturer varchar NOT NULL); |
| 24 |
CREATE TABLE merchandise (merchandise_id integer PRIMARY KEY NOT NULL, |
| 25 |
product_id integer NOT NULL REFERENCES product(product_id), |
| 26 |
insert_date datetime NOT NULL DEFAULT (date('now'))); |
| 27 |
CREATE TABLE URMETA_machine_location_SLOT_ID_seq (next_value integer PRIMARY KEY AUTOINCREMENT); |
| 28 |
DELETE FROM sqlite_sequence; |
| 29 |
INSERT INTO "sqlite_sequence" VALUES('URMETA_machine_location_SLOT_ID_seq',14); |
| 30 |
INSERT INTO "sqlite_sequence" VALUES('URMETA_content_type_TYPE_ID_seq',11); |
| 31 |
INSERT INTO "sqlite_sequence" VALUES('URMETA_COIN_COIN_ID_seq',135); |
| 32 |
CREATE TABLE machine_location (machine_location_id integer PRIMARY KEY NOT NULL, |
| 33 |
name varchar NOT NULL, |
| 34 |
is_buyable integer NOT NULL, |
| 35 |
cost_cents integer, |
| 36 |
label varchar, |
| 37 |
machine_id integer NOT NULL REFERENCES machine(machine_id)); |
| 38 |
INSERT INTO "machine_location" VALUES(8,'a',1,65,'Cookie',1); |
| 39 |
INSERT INTO "machine_location" VALUES(9,'b',1,100,'Apple',1); |
| 40 |
INSERT INTO "machine_location" VALUES(10,'c',1,150,'Coke',1); |
| 41 |
INSERT INTO "machine_location" VALUES(11,'bank',0,-1,NULL,1); |
| 42 |
INSERT INTO "machine_location" VALUES(12,'box',0,-1,NULL,1); |
| 43 |
INSERT INTO "machine_location" VALUES(13,'change',0,-1,NULL,1); |
| 44 |
INSERT INTO "machine_location" VALUES(14,'d',1,10000,'iPod',1); |
| 45 |
CREATE TABLE content (content_id PRIMARY KEY NOT NULL, |
| 46 |
subtype_name varchar, |
| 47 |
machine_location_id integer NOT NULL REFERENCES machine_location(machine_location_id), |
| 48 |
machine_id NOT NULL REFERENCES machine(machine_id)); |
| 49 |
INSERT INTO "content" VALUES('129','Vending::Coin',12,'1'); |
| 50 |
INSERT INTO "content" VALUES('130','Vending::Coin',12,'1'); |
| 51 |
INSERT INTO "content" VALUES('131','Vending::Coin',12,'1'); |
| 52 |
INSERT INTO "content" VALUES('132','Vending::Coin',12,'1'); |
| 53 |
INSERT INTO "content" VALUES('133','Vending::Coin',12,'1'); |
| 54 |
INSERT INTO "content" VALUES('134','Vending::Coin',12,'1'); |
| 55 |
INSERT INTO "content" VALUES('135','Vending::Coin',12,'1'); |
| 56 |
CREATE TABLE URMETA_content_type_TYPE_ID_seq (next_value integer PRIMARY KEY AUTOINCREMENT); |
| 57 |
CREATE TABLE URMETA_COIN_COIN_ID_seq (next_value integer PRIMARY KEY AUTOINCREMENT); |
| 58 |
COMMIT; |