aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/fixtures/db_definitions/db2.sql
blob: 033efcb0887c2dc53e879febd86f83b8cf571a11 (plain) (blame)
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
CREATE TABLE accounts (
  id int generated by default as identity (start with +10000),
  firm_id int default NULL,
  credit_limit int default NULL,
  PRIMARY KEY (id)
);

CREATE TABLE companies (
  id int generated by default as identity (start with +10000),
  type varchar(50) default NULL,
  ruby_type varchar(50) default NULL,
  firm_id int default NULL,
  name varchar(50) default NULL,
  client_of int default NULL,
  rating int default 1,
  PRIMARY KEY (id)
);

CREATE TABLE topics (
  id int generated by default as identity (start with +10000),
  title varchar(255) default NULL,
  author_name varchar(255) default NULL,
  author_email_address varchar(255) default NULL,
  written_on timestamp default NULL,
  bonus_time time default NULL,
  last_read date default NULL,
  content varchar(3000),
  approved smallint default 1,
  replies_count int default 0,
  parent_id int default NULL,
  type varchar(50) default NULL,
  PRIMARY KEY (id)
);

CREATE TABLE developers (
  id int generated by default as identity (start with +10000),
  name varchar(100) default NULL,
  salary int default 70000,
  PRIMARY KEY (id)
);

CREATE TABLE projects (
  id int generated by default as identity (start with +10000),
  name varchar(100) default NULL,
  PRIMARY KEY (id)
);

CREATE TABLE developers_projects (
  developer_id int NOT NULL,
  project_id int NOT NULL,
  joined_on date default NULL
);

CREATE TABLE customers (
  id int generated by default as identity (start with +10000),
  name varchar(100) default NULL,
  balance int default 0,
  address_street varchar(100) default NULL,
  address_city varchar(100) default NULL,
  address_country varchar(100) default NULL,
  PRIMARY KEY (id)
);

CREATE TABLE movies (
  movieid int generated by default as identity (start with +10000),
  name varchar(100) default NULL,
  PRIMARY KEY (movieid)
);

CREATE TABLE subscribers (
  nick varchar(100) NOT NULL,
  name varchar(100) default NULL,
  PRIMARY KEY (nick)
);

CREATE TABLE booleantests (
  id int generated by default as identity (start with +10000),
  value int default NULL,
  PRIMARY KEY (id)
);

CREATE TABLE auto_id_tests (
  auto_id int generated by default as identity (start with +10000),
  value int default NULL,
  PRIMARY KEY (auto_id)
);

CREATE TABLE entrants (
  id int NOT NULL PRIMARY KEY,
  name varchar(255) NOT NULL,
  course_id int NOT NULL
);

CREATE TABLE colnametests (
  id int generated by default as identity (start with +10000),
  references int NOT NULL,
  PRIMARY KEY (id)
);

CREATE TABLE mixins (
  id int generated by default as identity (start with +10000),
  parent_id int default NULL,
  pos int default NULL,
  created_at timestamp default NULL,
  updated_at timestamp default NULL,
  lft int default NULL,
  rgt int default NULL,
  root_id int default NULL,
  type varchar(40) default NULL,
  PRIMARY KEY (id)
);

CREATE TABLE people (
  id int generated by default as identity (start with +10000),
  first_name varchar(40) NOT NULL,
  lock_version int default 0,
  PRIMARY KEY  (id)
);

CREATE TABLE binaries (
  id int generated by default as identity (start with +10000),
  data blob(50000),
  PRIMARY KEY  (id)
);

CREATE TABLE computers (
  id int generated by default as identity (start with +10000),
  developer int NOT NULL
);