odbc-rails 1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +16 -0
- data/COPYING +21 -0
- data/ChangeLog +89 -0
- data/LICENSE +5 -0
- data/NEWS +12 -0
- data/README +282 -0
- data/lib/active_record/connection_adapters/odbc_adapter.rb +1792 -0
- data/lib/active_record/vendor/odbcext_db2.rb +87 -0
- data/lib/active_record/vendor/odbcext_informix.rb +132 -0
- data/lib/active_record/vendor/odbcext_informix_col.rb +45 -0
- data/lib/active_record/vendor/odbcext_ingres.rb +156 -0
- data/lib/active_record/vendor/odbcext_microsoftsqlserver.rb +185 -0
- data/lib/active_record/vendor/odbcext_microsoftsqlserver_col.rb +40 -0
- data/lib/active_record/vendor/odbcext_mysql.rb +136 -0
- data/lib/active_record/vendor/odbcext_oracle.rb +220 -0
- data/lib/active_record/vendor/odbcext_postgresql.rb +179 -0
- data/lib/active_record/vendor/odbcext_progress.rb +139 -0
- data/lib/active_record/vendor/odbcext_progress89.rb +259 -0
- data/lib/active_record/vendor/odbcext_sybase.rb +212 -0
- data/lib/active_record/vendor/odbcext_sybase_col.rb +49 -0
- data/lib/active_record/vendor/odbcext_virtuoso.rb +146 -0
- data/lib/odbc_adapter.rb +28 -0
- data/support/lib/active_record/connection_adapters/abstract/schema_definitions.rb +259 -0
- data/support/odbc_rails.diff +707 -0
- data/support/pack_odbc.rb +119 -0
- data/support/rake/rails_plugin_package_task.rb +212 -0
- data/support/test/base_test.rb +1349 -0
- data/support/test/migration_test.rb +566 -0
- data/test/connections/native_odbc/connection.rb +95 -0
- data/test/fixtures/db_definitions/db2.drop.sql +30 -0
- data/test/fixtures/db_definitions/db2.sql +217 -0
- data/test/fixtures/db_definitions/db22.drop.sql +2 -0
- data/test/fixtures/db_definitions/db22.sql +5 -0
- data/test/fixtures/db_definitions/informix.drop.sql +30 -0
- data/test/fixtures/db_definitions/informix.sql +205 -0
- data/test/fixtures/db_definitions/informix2.drop.sql +2 -0
- data/test/fixtures/db_definitions/informix2.sql +5 -0
- data/test/fixtures/db_definitions/ingres.drop.sql +62 -0
- data/test/fixtures/db_definitions/ingres.sql +232 -0
- data/test/fixtures/db_definitions/ingres2.drop.sql +2 -0
- data/test/fixtures/db_definitions/ingres2.sql +5 -0
- data/test/fixtures/db_definitions/mysql.drop.sql +30 -0
- data/test/fixtures/db_definitions/mysql.sql +219 -0
- data/test/fixtures/db_definitions/mysql2.drop.sql +2 -0
- data/test/fixtures/db_definitions/mysql2.sql +5 -0
- data/test/fixtures/db_definitions/oracle_odbc.drop.sql +64 -0
- data/test/fixtures/db_definitions/oracle_odbc.sql +257 -0
- data/test/fixtures/db_definitions/oracle_odbc2.drop.sql +2 -0
- data/test/fixtures/db_definitions/oracle_odbc2.sql +6 -0
- data/test/fixtures/db_definitions/progress.drop.sql +61 -0
- data/test/fixtures/db_definitions/progress.sql +234 -0
- data/test/fixtures/db_definitions/progress2.drop.sql +2 -0
- data/test/fixtures/db_definitions/progress2.sql +6 -0
- data/test/fixtures/db_definitions/sqlserver.drop.sql +30 -0
- data/test/fixtures/db_definitions/sqlserver.sql +203 -0
- data/test/fixtures/db_definitions/sqlserver2.drop.sql +2 -0
- data/test/fixtures/db_definitions/sqlserver2.sql +5 -0
- data/test/fixtures/db_definitions/sybase.drop.sql +31 -0
- data/test/fixtures/db_definitions/sybase.sql +204 -0
- data/test/fixtures/db_definitions/sybase2.drop.sql +4 -0
- data/test/fixtures/db_definitions/sybase2.sql +5 -0
- data/test/fixtures/db_definitions/virtuoso.drop.sql +30 -0
- data/test/fixtures/db_definitions/virtuoso.sql +200 -0
- data/test/fixtures/db_definitions/virtuoso2.drop.sql +2 -0
- data/test/fixtures/db_definitions/virtuoso2.sql +5 -0
- metadata +149 -0
@@ -0,0 +1,95 @@
|
|
1
|
+
#
|
2
|
+
# $Id: connection.rb,v 1.4 2006/10/09 07:25:07 source Exp $
|
3
|
+
#
|
4
|
+
# OpenLink ODBC Adapter for Ruby on Rails
|
5
|
+
# Copyright (C) 2006 OpenLink Software
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
8
|
+
# a copy of this software and associated documentation files (the
|
9
|
+
# "Software"), to deal in the Software without restriction, including
|
10
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
11
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
12
|
+
# permit persons to whom the Software is furnished to do so, subject
|
13
|
+
# to the following conditions:
|
14
|
+
#
|
15
|
+
# The above copyright notice and this permission notice shall be
|
16
|
+
# included in all copies or substantial portions of the Software.
|
17
|
+
#
|
18
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
19
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
20
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
21
|
+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
22
|
+
# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
23
|
+
# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
24
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
25
|
+
#
|
26
|
+
|
27
|
+
print "Using native ODBC\n"
|
28
|
+
require_dependency 'fixtures/course'
|
29
|
+
require 'logger'
|
30
|
+
|
31
|
+
#ActiveRecord::Base.logger = Logger.new(STDOUT)
|
32
|
+
#ActiveRecord::Base.logger = Logger.new("debug_odbc.log")
|
33
|
+
#Logger level default is the lowest available, Logger::DEBUG
|
34
|
+
#ActiveRecord::Base.logger.level = Logger::WARN
|
35
|
+
ActiveRecord::Base.colorize_logging = false
|
36
|
+
|
37
|
+
ActiveRecord::Base.establish_connection(
|
38
|
+
:adapter => "odbc",
|
39
|
+
:dsn => "a604-ora10-alice-testdb1",
|
40
|
+
:username => "oracle",
|
41
|
+
:password => "oracle",
|
42
|
+
:trace => true
|
43
|
+
)
|
44
|
+
|
45
|
+
Course.establish_connection(
|
46
|
+
:adapter => "odbc",
|
47
|
+
:dsn => "a604-ora10-alice-testdb2",
|
48
|
+
:username => "oracle",
|
49
|
+
:password => "oracle",
|
50
|
+
:trace => true
|
51
|
+
)
|
52
|
+
|
53
|
+
###########################################
|
54
|
+
# Using Sybase
|
55
|
+
|
56
|
+
=begin
|
57
|
+
ActiveRecord::Base.establish_connection(
|
58
|
+
:adapter => "odbc",
|
59
|
+
:dsn => "a609_syb15_trilby_testdb3",
|
60
|
+
:username => "sa",
|
61
|
+
:trace => true,
|
62
|
+
:convert_numeric_literals => true
|
63
|
+
)
|
64
|
+
|
65
|
+
Course.establish_connection(
|
66
|
+
:adapter => "odbc",
|
67
|
+
:dsn => "a609_syb15_trilby_testdb4",
|
68
|
+
:username => "sa",
|
69
|
+
:trace => true,
|
70
|
+
:convert_numeric_literals => true
|
71
|
+
)
|
72
|
+
=end
|
73
|
+
|
74
|
+
###########################################
|
75
|
+
# Using DB2
|
76
|
+
|
77
|
+
=begin
|
78
|
+
ActiveRecord::Base.establish_connection(
|
79
|
+
:adapter => "odbc",
|
80
|
+
:dsn => "a609_db2_alice_rails1",
|
81
|
+
:username => "db2admin",
|
82
|
+
:password => "db2admin",
|
83
|
+
:trace => true,
|
84
|
+
:convert_numeric_literals => true
|
85
|
+
)
|
86
|
+
|
87
|
+
Course.establish_connection(
|
88
|
+
:adapter => "odbc",
|
89
|
+
:dsn => "a609_db2_alice_rails2",
|
90
|
+
:username => "db2admin",
|
91
|
+
:password => "db2admin",
|
92
|
+
:trace => true,
|
93
|
+
:convert_numeric_literals => true
|
94
|
+
)
|
95
|
+
=end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
DROP TABLE accounts;
|
2
|
+
DROP TABLE funny_jokes;
|
3
|
+
DROP TABLE companies;
|
4
|
+
DROP TABLE topics;
|
5
|
+
DROP TABLE developers;
|
6
|
+
DROP TABLE projects;
|
7
|
+
DROP TABLE developers_projects;
|
8
|
+
DROP TABLE orders;
|
9
|
+
DROP TABLE customers;
|
10
|
+
DROP TABLE movies;
|
11
|
+
DROP TABLE subscribers;
|
12
|
+
DROP TABLE booleantests;
|
13
|
+
DROP TABLE auto_id_tests;
|
14
|
+
DROP TABLE entrants;
|
15
|
+
DROP TABLE colnametests;
|
16
|
+
DROP TABLE mixins;
|
17
|
+
DROP TABLE people;
|
18
|
+
DROP TABLE readers;
|
19
|
+
DROP TABLE binaries;
|
20
|
+
DROP TABLE computers;
|
21
|
+
DROP TABLE posts;
|
22
|
+
DROP TABLE comments;
|
23
|
+
DROP TABLE authors;
|
24
|
+
DROP TABLE tasks;
|
25
|
+
DROP TABLE categories;
|
26
|
+
DROP TABLE categories_posts;
|
27
|
+
DROP TABLE fk_test_has_pk;
|
28
|
+
DROP TABLE fk_test_has_fk;
|
29
|
+
DROP TABLE keyboards;
|
30
|
+
DROP TABLE legacy_things;
|
@@ -0,0 +1,217 @@
|
|
1
|
+
CREATE TABLE accounts (
|
2
|
+
id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 10000),
|
3
|
+
firm_id INT DEFAULT NULL,
|
4
|
+
credit_limit INT DEFAULT NULL,
|
5
|
+
PRIMARY KEY (id)
|
6
|
+
);
|
7
|
+
|
8
|
+
CREATE TABLE funny_jokes (
|
9
|
+
id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 10000),
|
10
|
+
name VARCHAR(50) DEFAULT NULL,
|
11
|
+
PRIMARY KEY (id)
|
12
|
+
);
|
13
|
+
|
14
|
+
CREATE TABLE companies (
|
15
|
+
id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 10000),
|
16
|
+
type VARCHAR(50) DEFAULT NULL,
|
17
|
+
ruby_type VARCHAR(50) DEFAULT NULL,
|
18
|
+
firm_id INT DEFAULT NULL,
|
19
|
+
name VARCHAR(50) DEFAULT NULL,
|
20
|
+
client_of INT DEFAULT NULL,
|
21
|
+
rating INT DEFAULT 1,
|
22
|
+
PRIMARY KEY (id)
|
23
|
+
);
|
24
|
+
|
25
|
+
CREATE TABLE topics (
|
26
|
+
id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 10000),
|
27
|
+
title VARCHAR(255) DEFAULT NULL,
|
28
|
+
author_name VARCHAR(255) DEFAULT NULL,
|
29
|
+
author_email_address VARCHAR(255) DEFAULT NULL,
|
30
|
+
written_on TIMESTAMP DEFAULT NULL,
|
31
|
+
bonus_time TIME DEFAULT NULL,
|
32
|
+
last_read DATE DEFAULT NULL,
|
33
|
+
content VARCHAR(3000),
|
34
|
+
approved SMALLINT DEFAULT 1,
|
35
|
+
replies_count INT DEFAULT 0,
|
36
|
+
parent_id INT DEFAULT NULL,
|
37
|
+
type VARCHAR(50) DEFAULT NULL,
|
38
|
+
PRIMARY KEY (id)
|
39
|
+
);
|
40
|
+
|
41
|
+
CREATE TABLE developers (
|
42
|
+
id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 10000),
|
43
|
+
name VARCHAR(100) DEFAULT NULL,
|
44
|
+
salary INT DEFAULT 70000,
|
45
|
+
created_at TIMESTAMP DEFAULT NULL,
|
46
|
+
updated_at TIMESTAMP DEFAULT NULL,
|
47
|
+
PRIMARY KEY (id)
|
48
|
+
);
|
49
|
+
|
50
|
+
CREATE TABLE projects (
|
51
|
+
id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 10000),
|
52
|
+
name VARCHAR(100) DEFAULT NULL,
|
53
|
+
type VARCHAR(255) DEFAULT NULL,
|
54
|
+
PRIMARY KEY (id)
|
55
|
+
);
|
56
|
+
|
57
|
+
CREATE TABLE developers_projects (
|
58
|
+
developer_id INT NOT NULL,
|
59
|
+
project_id INT NOT NULL,
|
60
|
+
joined_on DATE DEFAULT NULL,
|
61
|
+
access_level SMALLINT DEFAULT 1
|
62
|
+
);
|
63
|
+
|
64
|
+
CREATE TABLE orders (
|
65
|
+
id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 10000),
|
66
|
+
name VARCHAR(100) DEFAULT NULL,
|
67
|
+
billing_customer_id INT DEFAULT NULL,
|
68
|
+
shipping_customer_id INT DEFAULT NULL,
|
69
|
+
PRIMARY KEY (id)
|
70
|
+
);
|
71
|
+
|
72
|
+
CREATE TABLE customers (
|
73
|
+
id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 10000),
|
74
|
+
name VARCHAR(100) DEFAULT NULL,
|
75
|
+
balance INT DEFAULT 0,
|
76
|
+
address_street VARCHAR(100) DEFAULT NULL,
|
77
|
+
address_city VARCHAR(100) DEFAULT NULL,
|
78
|
+
address_country VARCHAR(100) DEFAULT NULL,
|
79
|
+
gps_location VARCHAR(100) DEFAULT NULL,
|
80
|
+
PRIMARY KEY (id)
|
81
|
+
);
|
82
|
+
|
83
|
+
CREATE TABLE movies (
|
84
|
+
movieid INT GENERATED BY DEFAULT AS IDENTITY (START WITH 10000),
|
85
|
+
name VARCHAR(100) DEFAULT NULL,
|
86
|
+
PRIMARY KEY (movieid)
|
87
|
+
);
|
88
|
+
|
89
|
+
CREATE TABLE subscribers (
|
90
|
+
nick VARCHAR(100) NOT NULL,
|
91
|
+
name VARCHAR(100) DEFAULT NULL,
|
92
|
+
PRIMARY KEY (nick)
|
93
|
+
);
|
94
|
+
|
95
|
+
CREATE TABLE booleantests (
|
96
|
+
id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 10000),
|
97
|
+
value INT DEFAULT NULL,
|
98
|
+
PRIMARY KEY (id)
|
99
|
+
);
|
100
|
+
|
101
|
+
CREATE TABLE auto_id_tests (
|
102
|
+
auto_id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 10000),
|
103
|
+
value INT DEFAULT NULL,
|
104
|
+
PRIMARY KEY (auto_id)
|
105
|
+
);
|
106
|
+
|
107
|
+
CREATE TABLE entrants (
|
108
|
+
id INT NOT NULL PRIMARY KEY,
|
109
|
+
name VARCHAR(255) NOT NULL,
|
110
|
+
course_id INT NOT NULL
|
111
|
+
);
|
112
|
+
|
113
|
+
CREATE TABLE colnametests (
|
114
|
+
id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 10000),
|
115
|
+
references INT NOT NULL,
|
116
|
+
PRIMARY KEY (id)
|
117
|
+
);
|
118
|
+
|
119
|
+
CREATE TABLE mixins (
|
120
|
+
id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 10000),
|
121
|
+
parent_id INT DEFAULT NULL,
|
122
|
+
pos INT DEFAULT NULL,
|
123
|
+
created_at TIMESTAMP DEFAULT NULL,
|
124
|
+
updated_at TIMESTAMP DEFAULT NULL,
|
125
|
+
lft INT DEFAULT NULL,
|
126
|
+
rgt INT DEFAULT NULL,
|
127
|
+
root_id INT DEFAULT NULL,
|
128
|
+
type VARCHAR(40) DEFAULT NULL,
|
129
|
+
PRIMARY KEY (id)
|
130
|
+
);
|
131
|
+
|
132
|
+
CREATE TABLE people (
|
133
|
+
id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 10000),
|
134
|
+
first_name VARCHAR(40) NOT NULL,
|
135
|
+
lock_version INT DEFAULT 0,
|
136
|
+
PRIMARY KEY (id)
|
137
|
+
);
|
138
|
+
|
139
|
+
CREATE TABLE readers (
|
140
|
+
id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 10000),
|
141
|
+
post_id INT NOT NULL,
|
142
|
+
person_id INT NOT NULL,
|
143
|
+
PRIMARY KEY (id)
|
144
|
+
);
|
145
|
+
|
146
|
+
CREATE TABLE binaries (
|
147
|
+
id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 10000),
|
148
|
+
data BLOB(50000),
|
149
|
+
PRIMARY KEY (id)
|
150
|
+
);
|
151
|
+
|
152
|
+
CREATE TABLE computers (
|
153
|
+
id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 10000),
|
154
|
+
developer INT NOT NULL,
|
155
|
+
"extendedWarranty" INT NOT NULL
|
156
|
+
);
|
157
|
+
|
158
|
+
CREATE TABLE posts (
|
159
|
+
id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 10000),
|
160
|
+
author_id INT DEFAULT NULL,
|
161
|
+
title VARCHAR(255) DEFAULT NULL,
|
162
|
+
type VARCHAR(255) DEFAULT NULL,
|
163
|
+
body VARCHAR(3000) DEFAULT NULL
|
164
|
+
);
|
165
|
+
|
166
|
+
CREATE TABLE comments (
|
167
|
+
id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 10000),
|
168
|
+
post_id INT DEFAULT NULL,
|
169
|
+
type VARCHAR(255) DEFAULT NULL,
|
170
|
+
body VARCHAR(3000) DEFAULT NULL
|
171
|
+
);
|
172
|
+
|
173
|
+
CREATE TABLE authors (
|
174
|
+
id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 10000),
|
175
|
+
name VARCHAR(255) DEFAULT NULL
|
176
|
+
);
|
177
|
+
|
178
|
+
CREATE TABLE tasks (
|
179
|
+
id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 10000),
|
180
|
+
starting TIMESTAMP DEFAULT NULL,
|
181
|
+
ending TIMESTAMP DEFAULT NULL
|
182
|
+
);
|
183
|
+
|
184
|
+
CREATE TABLE categories (
|
185
|
+
id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 10000),
|
186
|
+
name VARCHAR(255) NOT NULL,
|
187
|
+
type VARCHAR(40) DEFAULT NULL
|
188
|
+
);
|
189
|
+
|
190
|
+
CREATE TABLE categories_posts (
|
191
|
+
category_id INT NOT NULL,
|
192
|
+
post_id INT NOT NULL
|
193
|
+
);
|
194
|
+
|
195
|
+
CREATE TABLE keyboards (
|
196
|
+
key_number INT GENERATED BY DEFAULT AS IDENTITY (START WITH 10000),
|
197
|
+
name VARCHAR(255)
|
198
|
+
);
|
199
|
+
|
200
|
+
CREATE TABLE fk_test_has_pk (
|
201
|
+
id INT NOT NULL PRIMARY KEY
|
202
|
+
);
|
203
|
+
|
204
|
+
CREATE TABLE fk_test_has_fk (
|
205
|
+
id INT NOT NULL PRIMARY KEY,
|
206
|
+
fk_id INT NOT NULL,
|
207
|
+
|
208
|
+
FOREIGN KEY (fk_id) REFERENCES fk_test_has_pk(id)
|
209
|
+
);
|
210
|
+
|
211
|
+
--This table has an altered lock_version column name
|
212
|
+
CREATE TABLE legacy_things (
|
213
|
+
id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 10000),
|
214
|
+
tps_report_number INT DEFAULT NULL,
|
215
|
+
version INT DEFAULT 0,
|
216
|
+
PRIMARY KEY (id)
|
217
|
+
);
|
@@ -0,0 +1,30 @@
|
|
1
|
+
DROP TABLE accounts;
|
2
|
+
DROP TABLE funny_jokes;
|
3
|
+
DROP TABLE companies;
|
4
|
+
DROP TABLE topics;
|
5
|
+
DROP TABLE developers;
|
6
|
+
DROP TABLE projects;
|
7
|
+
DROP TABLE developers_projects;
|
8
|
+
DROP TABLE customers;
|
9
|
+
DROP TABLE orders;
|
10
|
+
DROP TABLE movies;
|
11
|
+
DROP TABLE subscribers;
|
12
|
+
DROP TABLE booleantests;
|
13
|
+
DROP TABLE auto_id_tests;
|
14
|
+
DROP TABLE entrants;
|
15
|
+
DROP TABLE colnametests;
|
16
|
+
DROP TABLE mixins;
|
17
|
+
DROP TABLE people;
|
18
|
+
DROP TABLE readers;
|
19
|
+
DROP TABLE binaries;
|
20
|
+
DROP TABLE computers;
|
21
|
+
DROP TABLE posts;
|
22
|
+
DROP TABLE comments;
|
23
|
+
DROP TABLE authors;
|
24
|
+
DROP TABLE tasks;
|
25
|
+
DROP TABLE categories;
|
26
|
+
DROP TABLE categories_posts;
|
27
|
+
DROP TABLE fk_test_has_fk;
|
28
|
+
DROP TABLE fk_test_has_pk;
|
29
|
+
DROP TABLE keyboards;
|
30
|
+
DROP TABLE legacy_things;
|
@@ -0,0 +1,205 @@
|
|
1
|
+
--Ensure environment variable DELIMIDENT=y
|
2
|
+
|
3
|
+
create table accounts (
|
4
|
+
id serial primary key,
|
5
|
+
firm_id int,
|
6
|
+
credit_limit int
|
7
|
+
);
|
8
|
+
|
9
|
+
create table funny_jokes (
|
10
|
+
id serial primary key,
|
11
|
+
name varchar(50)
|
12
|
+
);
|
13
|
+
|
14
|
+
create table companies (
|
15
|
+
id serial primary key,
|
16
|
+
type varchar(50),
|
17
|
+
ruby_type varchar(50),
|
18
|
+
firm_id int,
|
19
|
+
name varchar(50),
|
20
|
+
client_of int,
|
21
|
+
rating int default 1
|
22
|
+
);
|
23
|
+
|
24
|
+
create table topics (
|
25
|
+
id serial primary key,
|
26
|
+
title varchar(255),
|
27
|
+
author_name varchar(255),
|
28
|
+
author_email_address varchar(255),
|
29
|
+
written_on datetime year to second,
|
30
|
+
bonus_time datetime year to second,
|
31
|
+
last_read date,
|
32
|
+
content varchar(255),
|
33
|
+
approved smallint default 1,
|
34
|
+
replies_count int default 0,
|
35
|
+
parent_id int,
|
36
|
+
type varchar(50)
|
37
|
+
);
|
38
|
+
|
39
|
+
create table developers (
|
40
|
+
id serial primary key,
|
41
|
+
name varchar(100),
|
42
|
+
salary int default 70000,
|
43
|
+
created_at datetime year to second,
|
44
|
+
updated_at datetime year to second
|
45
|
+
);
|
46
|
+
|
47
|
+
create table projects (
|
48
|
+
id serial primary key,
|
49
|
+
name varchar(100),
|
50
|
+
type varchar(255)
|
51
|
+
);
|
52
|
+
|
53
|
+
create table developers_projects (
|
54
|
+
developer_id int not null,
|
55
|
+
project_id int not null,
|
56
|
+
joined_on date,
|
57
|
+
access_level int default 1
|
58
|
+
);
|
59
|
+
|
60
|
+
create table orders (
|
61
|
+
id serial primary key,
|
62
|
+
name varchar(100),
|
63
|
+
billing_customer_id int,
|
64
|
+
shipping_customer_id int
|
65
|
+
);
|
66
|
+
|
67
|
+
|
68
|
+
create table customers (
|
69
|
+
id serial primary key,
|
70
|
+
name varchar(100),
|
71
|
+
balance int default 0,
|
72
|
+
address_street varchar(100),
|
73
|
+
address_city varchar(100),
|
74
|
+
address_country varchar(100),
|
75
|
+
gps_location varchar(100)
|
76
|
+
);
|
77
|
+
|
78
|
+
create table movies (
|
79
|
+
movieid serial primary key,
|
80
|
+
name varchar(100)
|
81
|
+
);
|
82
|
+
|
83
|
+
create table subscribers (
|
84
|
+
nick varchar(100) primary key,
|
85
|
+
name varchar(100)
|
86
|
+
);
|
87
|
+
|
88
|
+
create table booleantests (
|
89
|
+
id serial primary key,
|
90
|
+
value smallint
|
91
|
+
);
|
92
|
+
|
93
|
+
create table auto_id_tests (
|
94
|
+
auto_id serial primary key,
|
95
|
+
value int
|
96
|
+
);
|
97
|
+
|
98
|
+
create table entrants (
|
99
|
+
id int primary key,
|
100
|
+
name varchar(255) not null,
|
101
|
+
course_id int not null
|
102
|
+
);
|
103
|
+
|
104
|
+
create table colnametests (
|
105
|
+
id serial primary key,
|
106
|
+
"references" int not null
|
107
|
+
);
|
108
|
+
|
109
|
+
create table mixins (
|
110
|
+
id serial primary key,
|
111
|
+
parent_id int,
|
112
|
+
pos int,
|
113
|
+
created_at datetime year to second,
|
114
|
+
updated_at datetime year to second,
|
115
|
+
lft int,
|
116
|
+
rgt int,
|
117
|
+
root_id int,
|
118
|
+
type varchar(40)
|
119
|
+
);
|
120
|
+
|
121
|
+
create table people (
|
122
|
+
id serial,
|
123
|
+
first_name varchar(40),
|
124
|
+
lock_version int default 0,
|
125
|
+
primary key (id)
|
126
|
+
);
|
127
|
+
|
128
|
+
create table readers (
|
129
|
+
id serial,
|
130
|
+
post_id int not null,
|
131
|
+
person_id int not null,
|
132
|
+
primary key (id)
|
133
|
+
);
|
134
|
+
|
135
|
+
create table binaries (
|
136
|
+
id serial primary key,
|
137
|
+
data byte
|
138
|
+
);
|
139
|
+
|
140
|
+
create table computers (
|
141
|
+
id serial primary key,
|
142
|
+
developer int not null,
|
143
|
+
"extendedWarranty" int not null
|
144
|
+
);
|
145
|
+
|
146
|
+
create table posts (
|
147
|
+
id serial primary key,
|
148
|
+
author_id int,
|
149
|
+
title varchar(255),
|
150
|
+
type varchar(255),
|
151
|
+
body lvarchar
|
152
|
+
);
|
153
|
+
|
154
|
+
create table comments (
|
155
|
+
id serial primary key,
|
156
|
+
post_id int,
|
157
|
+
type varchar(255),
|
158
|
+
body lvarchar
|
159
|
+
);
|
160
|
+
|
161
|
+
create table authors (
|
162
|
+
id serial primary key,
|
163
|
+
name varchar(255)
|
164
|
+
);
|
165
|
+
|
166
|
+
create table tasks (
|
167
|
+
id serial primary key,
|
168
|
+
starting datetime year to second,
|
169
|
+
ending datetime year to second
|
170
|
+
);
|
171
|
+
|
172
|
+
create table categories (
|
173
|
+
id serial primary key,
|
174
|
+
name varchar(255),
|
175
|
+
type varchar(255)
|
176
|
+
);
|
177
|
+
|
178
|
+
create table categories_posts (
|
179
|
+
category_id int not null,
|
180
|
+
post_id int not null
|
181
|
+
);
|
182
|
+
|
183
|
+
create table fk_test_has_pk (
|
184
|
+
id integer primary key
|
185
|
+
);
|
186
|
+
|
187
|
+
create table fk_test_has_fk (
|
188
|
+
id integer primary key,
|
189
|
+
fk_id integer not null,
|
190
|
+
|
191
|
+
foreign key (fk_id) references fk_test_has_pk(id)
|
192
|
+
);
|
193
|
+
|
194
|
+
create table keyboards (
|
195
|
+
key_number serial primary key,
|
196
|
+
name varchar(50)
|
197
|
+
);
|
198
|
+
|
199
|
+
--This table has an altered lock_version column name.
|
200
|
+
create table legacy_things (
|
201
|
+
id serial,
|
202
|
+
tps_report_number int,
|
203
|
+
version int default 0,
|
204
|
+
primary key (id)
|
205
|
+
);
|