File: TestSchema-0.001-SQLite.sql

package info (click to toggle)
libdbix-class-helpers-perl 2.023007-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 792 kB
  • ctags: 294
  • sloc: perl: 3,872; sql: 161; makefile: 7
file content (106 lines) | stat: -rw-r--r-- 2,093 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
-- 
-- Created by SQL::Translator::Producer::SQLite
-- Created on Tue Sep 16 19:48:36 2014
-- 

BEGIN TRANSACTION;

--
-- Table: Bloaty
--
CREATE TABLE Bloaty (
  id INTEGER PRIMARY KEY NOT NULL,
  name varchar NOT NULL,
  literature text,
  your_mom blob
);

--
-- Table: Gnarly
--
CREATE TABLE Gnarly (
  id INTEGER PRIMARY KEY NOT NULL,
  name varchar NOT NULL,
  literature text,
  your_mom blob
);

--
-- Table: HasAccessor
--
CREATE TABLE HasAccessor (
  id INTEGER PRIMARY KEY NOT NULL,
  usable_column varchar NOT NULL,
  unusable_column varchar NOT NULL
);

--
-- Table: HasDateOps
--
CREATE TABLE HasDateOps (
  id INTEGER PRIMARY KEY NOT NULL,
  a_date datetime NOT NULL,
  b_date datetime
);

--
-- Table: Station
--
CREATE TABLE Station (
  id INTEGER PRIMARY KEY NOT NULL,
  name varchar NOT NULL
);

--
-- Table: Bar
--
CREATE TABLE Bar (
  id INTEGER PRIMARY KEY NOT NULL,
  foo_id integer NOT NULL,
  FOREIGN KEY (foo_id) REFERENCES Foo(id) ON DELETE CASCADE ON UPDATE CASCADE
);

CREATE INDEX Bar_idx_foo_id ON Bar (foo_id);

--
-- Table: Foo
--
CREATE TABLE Foo (
  id INTEGER PRIMARY KEY NOT NULL,
  bar_id integer NOT NULL,
  FOREIGN KEY (bar_id) REFERENCES Bar(id) ON DELETE CASCADE ON UPDATE CASCADE
);

CREATE INDEX Foo_idx_bar_id ON Foo (bar_id);

--
-- Table: Foo_Bar
--
CREATE TABLE Foo_Bar (
  foo_id integer NOT NULL,
  bar_id integer(12) NOT NULL,
  PRIMARY KEY (foo_id, bar_id),
  FOREIGN KEY (bar_id) REFERENCES Bar(id),
  FOREIGN KEY (foo_id) REFERENCES Foo(id)
);

CREATE INDEX Foo_Bar_idx_bar_id ON Foo_Bar (bar_id);

CREATE INDEX Foo_Bar_idx_foo_id ON Foo_Bar (foo_id);

--
-- Table: Gnarly_Station
--
CREATE TABLE Gnarly_Station (
  gnarly_id int NOT NULL,
  station_id int NOT NULL,
  PRIMARY KEY (gnarly_id, station_id),
  FOREIGN KEY (gnarly_id) REFERENCES Gnarly(id) ON DELETE CASCADE ON UPDATE CASCADE,
  FOREIGN KEY (station_id) REFERENCES Station(id) ON DELETE CASCADE ON UPDATE CASCADE
);

CREATE INDEX Gnarly_Station_idx_gnarly_id ON Gnarly_Station (gnarly_id);

CREATE INDEX Gnarly_Station_idx_station_id ON Gnarly_Station (station_id);

COMMIT;