activerecord-odbc-adapter 2.0
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 +139 -0
- data/LICENSE +5 -0
- data/NEWS +25 -0
- data/README +229 -0
- data/lib/active_record/connection_adapters/odbc_adapter.rb +1950 -0
- data/lib/active_record/vendor/odbcext_db2.rb +87 -0
- data/lib/active_record/vendor/odbcext_informix.rb +144 -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 +216 -0
- data/lib/active_record/vendor/odbcext_microsoftsqlserver_col.rb +40 -0
- data/lib/active_record/vendor/odbcext_mysql.rb +174 -0
- data/lib/active_record/vendor/odbcext_oracle.rb +219 -0
- data/lib/active_record/vendor/odbcext_postgresql.rb +158 -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_sqlanywhere.rb +115 -0
- data/lib/active_record/vendor/odbcext_sqlanywhere_col.rb +49 -0
- data/lib/active_record/vendor/odbcext_sybase.rb +213 -0
- data/lib/active_record/vendor/odbcext_sybase_col.rb +49 -0
- data/lib/active_record/vendor/odbcext_virtuoso.rb +158 -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 +367 -0
- data/support/pack_odbc.rb +119 -0
- data/support/rake/rails_plugin_package_task.rb +212 -0
- data/support/rake_fixes/README +6 -0
- data/support/rake_fixes/databases.dif +13 -0
- data/support/test/base_test.rb +1765 -0
- data/support/test/migration_test.rb +1007 -0
- data/test/connections/native_odbc/connection.rb +137 -0
- data/test/fixtures/db_definitions/db2.drop.sql +33 -0
- data/test/fixtures/db_definitions/db2.sql +237 -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 +33 -0
- data/test/fixtures/db_definitions/informix.sql +223 -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 +68 -0
- data/test/fixtures/db_definitions/ingres.sql +252 -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 +33 -0
- data/test/fixtures/db_definitions/mysql.sql +238 -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 +72 -0
- data/test/fixtures/db_definitions/oracle_odbc.sql +296 -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/postgresql.drop.sql +38 -0
- data/test/fixtures/db_definitions/postgresql.sql +267 -0
- data/test/fixtures/db_definitions/postgresql2.drop.sql +2 -0
- data/test/fixtures/db_definitions/postgresql2.sql +5 -0
- data/test/fixtures/db_definitions/progress.drop.sql +67 -0
- data/test/fixtures/db_definitions/progress.sql +255 -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 +35 -0
- data/test/fixtures/db_definitions/sqlserver.sql +247 -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 +35 -0
- data/test/fixtures/db_definitions/sybase.sql +222 -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 +33 -0
- data/test/fixtures/db_definitions/virtuoso.sql +218 -0
- data/test/fixtures/db_definitions/virtuoso2.drop.sql +2 -0
- data/test/fixtures/db_definitions/virtuoso2.sql +5 -0
- metadata +166 -0
@@ -0,0 +1,137 @@
|
|
1
|
+
#
|
2
|
+
# $Id: connection.rb,v 1.6 2008/04/22 16:55:12 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
|
+
RAILS_DEFAULT_LOGGER = Logger.new("debug_odbc.log")
|
32
|
+
#Logger level default is the lowest available, Logger::DEBUG
|
33
|
+
#RAILS_DEFAULT_LOGGER.level = Logger::WARN
|
34
|
+
RAILS_DEFAULT_LOGGER.colorize_logging = false
|
35
|
+
ActiveRecord::Base.logger = RAILS_DEFAULT_LOGGER
|
36
|
+
|
37
|
+
ActiveRecord::Base.configurations = {
|
38
|
+
'arunit' => {
|
39
|
+
:adapter => "odbc",
|
40
|
+
:dsn => "a609_ora10_alice_test1",
|
41
|
+
:username => "scott",
|
42
|
+
:password => "tiger",
|
43
|
+
:emulate_booleans => true,
|
44
|
+
:trace => false
|
45
|
+
},
|
46
|
+
'arunit2' => {
|
47
|
+
:adapter => "odbc",
|
48
|
+
:dsn => "a609_ora10_alice_test1",
|
49
|
+
:username => "scott",
|
50
|
+
:password => "tiger",
|
51
|
+
:emulate_booleans => true,
|
52
|
+
:trace => false
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
ActiveRecord::Base.establish_connection 'arunit'
|
57
|
+
Course.establish_connection 'arunit2'
|
58
|
+
|
59
|
+
###########################################
|
60
|
+
# Using DSN-less connection
|
61
|
+
|
62
|
+
=begin
|
63
|
+
ActiveRecord::Base.configurations = {
|
64
|
+
'arunit' => {
|
65
|
+
:adapter => "odbc",
|
66
|
+
:conn_str => "Driver={OpenLink Lite for MySQL [6.0]};Database=rails_testdb1;Port=3306;UID=myuid;PWD=mypwd;"
|
67
|
+
:emulate_booleans => true,
|
68
|
+
:trace => false
|
69
|
+
},
|
70
|
+
'arunit2' => {
|
71
|
+
:adapter => "odbc",
|
72
|
+
:conn_str => "Driver={OpenLink Lite for MySQL [6.0]};Database=rails_testdb2;Port=3306;UID=myuid;PWD=mypwd;"
|
73
|
+
:emulate_booleans => true,
|
74
|
+
:trace => false
|
75
|
+
}
|
76
|
+
}
|
77
|
+
|
78
|
+
ActiveRecord::Base.establish_connection 'arunit'
|
79
|
+
Course.establish_connection 'arunit2'
|
80
|
+
=end
|
81
|
+
|
82
|
+
###########################################
|
83
|
+
# Using DB2
|
84
|
+
|
85
|
+
=begin
|
86
|
+
ActiveRecord::Base.configurations = {
|
87
|
+
'arunit' => {
|
88
|
+
:adapter => "odbc",
|
89
|
+
:dsn => "a610_db2_alice_rails1",
|
90
|
+
:username => "db2admin",
|
91
|
+
:password => "db2admin",
|
92
|
+
:trace => true,
|
93
|
+
:convert_numeric_literals => true
|
94
|
+
},
|
95
|
+
'arunit2' => {
|
96
|
+
:adapter => "odbc",
|
97
|
+
:dsn => "a610_db2_alice_rails2",
|
98
|
+
:username => "db2admin",
|
99
|
+
:password => "db2admin",
|
100
|
+
:trace => true,
|
101
|
+
:convert_numeric_literals => true
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
ActiveRecord::Base.establish_connection 'arunit'
|
106
|
+
Course.establish_connection 'arunit2'
|
107
|
+
=end
|
108
|
+
|
109
|
+
###########################################
|
110
|
+
# Using Sybase 15
|
111
|
+
|
112
|
+
=begin
|
113
|
+
ActiveRecord::Base.configurations = {
|
114
|
+
'arunit' => {
|
115
|
+
:adapter => "odbc",
|
116
|
+
:dsn => "a609_syb15_trilby_testdb3",
|
117
|
+
:username => "sa",
|
118
|
+
# :password => "",
|
119
|
+
:trace => true,
|
120
|
+
:convert_numeric_literals => true
|
121
|
+
},
|
122
|
+
'arunit2' => {
|
123
|
+
:adapter => "odbc",
|
124
|
+
:dsn => "a609_syb15_trilby_testdb4",
|
125
|
+
:username => "sa",
|
126
|
+
# :password => "",
|
127
|
+
:trace => true,
|
128
|
+
:convert_numeric_literals => true
|
129
|
+
}
|
130
|
+
}
|
131
|
+
|
132
|
+
ActiveRecord::Base.establish_connection 'arunit'
|
133
|
+
Course.establish_connection 'arunit2'
|
134
|
+
=end
|
135
|
+
|
136
|
+
###########################################
|
137
|
+
puts "Using DSN: #{ActiveRecord::Base.configurations["arunit"][:dsn]}"
|
@@ -0,0 +1,33 @@
|
|
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;
|
31
|
+
DROP TABLE numeric_data;
|
32
|
+
DROP TABLE mixed_case_monkeys;
|
33
|
+
DROP TABLE minimalistics;
|
@@ -0,0 +1,237 @@
|
|
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
|
+
);
|
218
|
+
|
219
|
+
CREATE TABLE numeric_data (
|
220
|
+
id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 10000),
|
221
|
+
bank_balance DECIMAL(10,2),
|
222
|
+
big_bank_balance DECIMAL(15,2),
|
223
|
+
world_population DECIMAL(10),
|
224
|
+
my_house_population DECIMAL(2),
|
225
|
+
decimal_number_with_default DECIMAL(3,2) DEFAULT 2.78
|
226
|
+
);
|
227
|
+
|
228
|
+
CREATE TABLE mixed_case_monkeys (
|
229
|
+
"monkeyID" INT GENERATED BY DEFAULT AS IDENTITY (START WITH 10000),
|
230
|
+
"fleaCount" INT DEFAULT NULL,
|
231
|
+
PRIMARY KEY (monkeyID)
|
232
|
+
);
|
233
|
+
|
234
|
+
CREATE TABLE minimalistics (
|
235
|
+
id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 10000),
|
236
|
+
PRIMARY KEY (id)
|
237
|
+
);
|
@@ -0,0 +1,33 @@
|
|
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;
|
31
|
+
DROP TABLE numeric_data;
|
32
|
+
DROP TABLE mixed_case_monkeys;
|
33
|
+
DROP TABLE minimalistics;
|