ibm_db 0.9.5 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +5 -0
- data/README +63 -97
- data/ext/ibm_db.c +20 -4
- data/ext/ruby_ibm_db.h +10 -0
- data/lib/active_record/connection_adapters/ibm_db_adapter.rb +2 -4
- data/test/{adapter_test.rb → cases/adapter_test.rb} +39 -14
- data/test/cases/associations/cascaded_eager_loading_test.rb +113 -0
- data/test/{associations → cases/associations}/eager_test.rb +231 -65
- data/test/cases/associations/has_and_belongs_to_many_associations_test.rb +686 -0
- data/test/cases/associations/join_model_test.rb +797 -0
- data/test/{base_test.rb → cases/base_test.rb} +605 -385
- data/test/cases/calculations_test.rb +275 -0
- data/test/cases/finder_test.rb +885 -0
- data/test/cases/fixtures_test.rb +630 -0
- data/test/{migration_test.rb → cases/migration_test.rb} +530 -146
- data/test/cases/query_cache_test.rb +127 -0
- data/test/cases/validations_test.rb +1509 -0
- data/test/connections/native_ibm_db/connection.rb +1 -1
- data/test/models/warehouse_thing.rb +5 -0
- data/test/schema/i5/ibm_db_specific_schema.rb +133 -0
- data/test/schema/ids/ibm_db_specific_schema.rb +136 -0
- data/test/schema/luw/ibm_db_specific_schema.rb +133 -0
- data/test/schema/schema.rb +432 -0
- data/test/schema/zOS/ibm_db_specific_schema.rb +204 -0
- metadata +29 -33
- data/test/associations_test.rb +0 -2151
- data/test/fixtures/db_definitions/i5/ibm_db.drop.sql +0 -33
- data/test/fixtures/db_definitions/i5/ibm_db.sql +0 -236
- data/test/fixtures/db_definitions/i5/ibm_db2.drop.sql +0 -2
- data/test/fixtures/db_definitions/i5/ibm_db2.sql +0 -5
- data/test/fixtures/db_definitions/ids/ibm_db.drop.sql +0 -33
- data/test/fixtures/db_definitions/ids/ibm_db.sql +0 -237
- data/test/fixtures/db_definitions/ids/ibm_db2.drop.sql +0 -2
- data/test/fixtures/db_definitions/ids/ibm_db2.sql +0 -5
- data/test/fixtures/db_definitions/luw/ibm_db.drop.sql +0 -33
- data/test/fixtures/db_definitions/luw/ibm_db.sql +0 -236
- data/test/fixtures/db_definitions/luw/ibm_db2.drop.sql +0 -2
- data/test/fixtures/db_definitions/luw/ibm_db2.sql +0 -5
- data/test/fixtures/db_definitions/schema.rb +0 -361
- data/test/fixtures/db_definitions/zOS/ibm_db.drop.sql +0 -33
- data/test/fixtures/db_definitions/zOS/ibm_db.sql +0 -288
- data/test/fixtures/db_definitions/zOS/ibm_db2.drop.sql +0 -2
- data/test/fixtures/db_definitions/zOS/ibm_db2.sql +0 -7
- data/test/locking_test.rb +0 -282
@@ -1,33 +0,0 @@
|
|
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;
|
@@ -1,236 +0,0 @@
|
|
1
|
-
CREATE TABLE accounts (
|
2
|
-
id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 100),
|
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 100),
|
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 100),
|
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 100),
|
27
|
-
title VARCHAR(255) DEFAULT NULL,
|
28
|
-
author_name VARCHAR(255) DEFAULT NULL,
|
29
|
-
author_email_address VARCHAR(255) DEFAULT NULL,
|
30
|
-
written_on TIME 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 100),
|
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 100),
|
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 100),
|
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 100),
|
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 100),
|
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 100),
|
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 100),
|
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 100),
|
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 100),
|
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 100),
|
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 100),
|
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 100),
|
148
|
-
data BLOB(5000000),
|
149
|
-
PRIMARY KEY (id)
|
150
|
-
);
|
151
|
-
|
152
|
-
CREATE TABLE computers (
|
153
|
-
id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 100),
|
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 100),
|
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 100),
|
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 100),
|
175
|
-
name VARCHAR(255) DEFAULT NULL
|
176
|
-
);
|
177
|
-
|
178
|
-
CREATE TABLE tasks (
|
179
|
-
id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 100),
|
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 100),
|
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 100),
|
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 100),
|
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 100),
|
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 100),
|
230
|
-
fleaCount INT DEFAULT 0,
|
231
|
-
PRIMARY KEY (monkeyID)
|
232
|
-
);
|
233
|
-
|
234
|
-
CREATE TABLE minimalistics (
|
235
|
-
id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 100)
|
236
|
-
);
|
@@ -1,361 +0,0 @@
|
|
1
|
-
ActiveRecord::Schema.define do
|
2
|
-
|
3
|
-
# adapter name is checked because we are under a transition of
|
4
|
-
# moving the sql files under activerecord/test/fixtures/db_definitions
|
5
|
-
# to this file, schema.rb.
|
6
|
-
if adapter_name == "MySQL"
|
7
|
-
|
8
|
-
# Please keep these create table statements in alphabetical order
|
9
|
-
# unless the ordering matters. In which case, define them below
|
10
|
-
create_table :accounts, :force => true do |t|
|
11
|
-
t.integer :firm_id
|
12
|
-
t.integer :credit_limit
|
13
|
-
end
|
14
|
-
|
15
|
-
create_table :authors, :force => true do |t|
|
16
|
-
t.string :name, :null => false
|
17
|
-
end
|
18
|
-
|
19
|
-
create_table :auto_id_tests, :force => true, :id => false do |t|
|
20
|
-
t.primary_key :auto_id
|
21
|
-
t.integer :value
|
22
|
-
end
|
23
|
-
|
24
|
-
create_table :binaries, :force => true do |t|
|
25
|
-
t.binary :data
|
26
|
-
end
|
27
|
-
|
28
|
-
create_table :booleantests, :force => true do |t|
|
29
|
-
t.integer :value
|
30
|
-
end
|
31
|
-
|
32
|
-
create_table :categories, :force => true do |t|
|
33
|
-
t.string :name, :null => false
|
34
|
-
t.string :type
|
35
|
-
end
|
36
|
-
|
37
|
-
create_table :categories_posts, :force => true, :id => false do |t|
|
38
|
-
t.integer :category_id, :null => false
|
39
|
-
t.integer :post_id, :null => false
|
40
|
-
end
|
41
|
-
|
42
|
-
create_table :colnametests, :force => true do |t|
|
43
|
-
t.integer :references, :null => false
|
44
|
-
end
|
45
|
-
|
46
|
-
create_table :comments, :force => true do |t|
|
47
|
-
t.integer :post_id, :null => false
|
48
|
-
t.text :body, :null => false
|
49
|
-
t.string :type
|
50
|
-
end
|
51
|
-
|
52
|
-
create_table :companies, :force => true do |t|
|
53
|
-
t.string :type
|
54
|
-
t.string :ruby_type
|
55
|
-
t.integer :firm_id
|
56
|
-
t.string :name
|
57
|
-
t.integer :client_of
|
58
|
-
t.integer :rating, :default => 1
|
59
|
-
end
|
60
|
-
|
61
|
-
create_table :computers, :force => true do |t|
|
62
|
-
t.integer :developer, :null => false
|
63
|
-
t.integer :extendedWarranty, :null => false
|
64
|
-
end
|
65
|
-
|
66
|
-
|
67
|
-
create_table :customers, :force => true do |t|
|
68
|
-
t.string :name
|
69
|
-
t.integer :balance, :default => 0
|
70
|
-
t.string :address_street
|
71
|
-
t.string :address_city
|
72
|
-
t.string :address_country
|
73
|
-
t.string :gps_location
|
74
|
-
end
|
75
|
-
|
76
|
-
create_table :developers, :force => true do |t|
|
77
|
-
t.string :name
|
78
|
-
t.integer :salary, :default => 70000
|
79
|
-
t.datetime :created_at
|
80
|
-
t.datetime :updated_at
|
81
|
-
end
|
82
|
-
|
83
|
-
create_table :developers_projects, :force => true, :id => false do |t|
|
84
|
-
t.integer :developer_id, :null => false
|
85
|
-
t.integer :project_id, :null => false
|
86
|
-
t.date :joined_on
|
87
|
-
t.integer :access_level, :default => 1
|
88
|
-
end
|
89
|
-
|
90
|
-
create_table :entrants, :force => true do |t|
|
91
|
-
t.string :name, :null => false
|
92
|
-
t.integer :course_id, :null => false
|
93
|
-
end
|
94
|
-
|
95
|
-
create_table :funny_jokes, :force => true do |t|
|
96
|
-
t.string :name
|
97
|
-
end
|
98
|
-
|
99
|
-
create_table :keyboards, :force => true, :id => false do |t|
|
100
|
-
t.primary_key :key_number
|
101
|
-
t.string :name
|
102
|
-
end
|
103
|
-
|
104
|
-
create_table :legacy_things, :force => true do |t|
|
105
|
-
t.integer :tps_report_number
|
106
|
-
t.integer :version, :null => false, :default => 0
|
107
|
-
end
|
108
|
-
|
109
|
-
create_table :minimalistics, :force => true do |t|
|
110
|
-
end
|
111
|
-
|
112
|
-
create_table :mixed_case_monkeys, :force => true, :id => false do |t|
|
113
|
-
t.primary_key :monkeyID
|
114
|
-
t.integer :fleaCount
|
115
|
-
end
|
116
|
-
|
117
|
-
create_table :mixins, :force => true do |t|
|
118
|
-
t.integer :parent_id
|
119
|
-
t.integer :pos
|
120
|
-
t.datetime :created_at
|
121
|
-
t.datetime :updated_at
|
122
|
-
t.integer :lft
|
123
|
-
t.integer :rgt
|
124
|
-
t.integer :root_id
|
125
|
-
t.string :type
|
126
|
-
end
|
127
|
-
|
128
|
-
create_table :movies, :force => true, :id => false do |t|
|
129
|
-
t.primary_key :movieid
|
130
|
-
t.string :name
|
131
|
-
end
|
132
|
-
|
133
|
-
create_table :numeric_data, :force => true do |t|
|
134
|
-
t.decimal :bank_balance, :precision => 10, :scale => 2
|
135
|
-
t.decimal :big_bank_balance, :precision => 15, :scale => 2
|
136
|
-
t.decimal :world_population, :precision => 10, :scale => 0
|
137
|
-
t.decimal :my_house_population, :precision => 2, :scale => 0
|
138
|
-
t.decimal :decimal_number_with_default, :precision => 3, :scale => 2, :default => 2.78
|
139
|
-
end
|
140
|
-
|
141
|
-
create_table :orders, :force => true do |t|
|
142
|
-
t.string :name
|
143
|
-
t.integer :billing_customer_id
|
144
|
-
t.integer :shipping_customer_id
|
145
|
-
end
|
146
|
-
|
147
|
-
create_table :people, :force => true do |t|
|
148
|
-
t.string :first_name, :null => false
|
149
|
-
t.integer :lock_version, :null => false, :default => 0
|
150
|
-
end
|
151
|
-
|
152
|
-
create_table :posts, :force => true do |t|
|
153
|
-
t.integer :author_id
|
154
|
-
t.string :title, :null => false
|
155
|
-
t.text :body, :null => false
|
156
|
-
t.string :type
|
157
|
-
end
|
158
|
-
|
159
|
-
create_table :projects, :force => true do |t|
|
160
|
-
t.string :name
|
161
|
-
t.string :type
|
162
|
-
end
|
163
|
-
|
164
|
-
create_table :readers, :force => true do |t|
|
165
|
-
t.integer :post_id, :null => false
|
166
|
-
t.integer :person_id, :null => false
|
167
|
-
end
|
168
|
-
|
169
|
-
create_table :subscribers, :force => true, :id => false do |t|
|
170
|
-
t.string :nick, :null => false
|
171
|
-
t.string :name
|
172
|
-
end
|
173
|
-
add_index :subscribers, :nick, :unique => true
|
174
|
-
|
175
|
-
create_table :tasks, :force => true do |t|
|
176
|
-
t.datetime :starting
|
177
|
-
t.datetime :ending
|
178
|
-
end
|
179
|
-
|
180
|
-
create_table :topics, :force => true do |t|
|
181
|
-
t.string :title
|
182
|
-
t.string :author_name
|
183
|
-
t.string :author_email_address
|
184
|
-
t.datetime :written_on
|
185
|
-
t.time :bonus_time
|
186
|
-
t.date :last_read
|
187
|
-
t.text :content
|
188
|
-
t.boolean :approved, :default => true
|
189
|
-
t.integer :replies_count, :default => 0
|
190
|
-
t.integer :parent_id
|
191
|
-
t.string :type
|
192
|
-
end
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
### These tables are created last as the order is significant
|
197
|
-
|
198
|
-
# fk_test_has_fk should be before fk_test_has_pk
|
199
|
-
create_table :fk_test_has_fk, :force => true do |t|
|
200
|
-
t.integer :fk_id, :null => false
|
201
|
-
end
|
202
|
-
|
203
|
-
create_table :fk_test_has_pk, :force => true do |t|
|
204
|
-
end
|
205
|
-
|
206
|
-
execute 'alter table fk_test_has_fk
|
207
|
-
add FOREIGN KEY (`fk_id`) REFERENCES `fk_test_has_pk`(`id`)'
|
208
|
-
|
209
|
-
|
210
|
-
end
|
211
|
-
|
212
|
-
# For Firebird, set the sequence values 10000 when create_table is called;
|
213
|
-
# this prevents primary key collisions between "normally" created records
|
214
|
-
# and fixture-based (YAML) records.
|
215
|
-
if adapter_name == "Firebird"
|
216
|
-
def create_table(*args, &block)
|
217
|
-
ActiveRecord::Base.connection.create_table(*args, &block)
|
218
|
-
ActiveRecord::Base.connection.execute "SET GENERATOR #{args.first}_seq TO 10000"
|
219
|
-
end
|
220
|
-
end
|
221
|
-
|
222
|
-
create_table :taggings, :force => true do |t|
|
223
|
-
t.column :tag_id, :integer
|
224
|
-
t.column :super_tag_id, :integer
|
225
|
-
t.column :taggable_type, :string
|
226
|
-
t.column :taggable_id, :integer
|
227
|
-
end
|
228
|
-
|
229
|
-
create_table :tags, :force => true do |t|
|
230
|
-
t.column :name, :string
|
231
|
-
t.column :taggings_count, :integer, :default => 0
|
232
|
-
end
|
233
|
-
|
234
|
-
create_table :categorizations, :force => true do |t|
|
235
|
-
t.column :category_id, :integer
|
236
|
-
t.column :post_id, :integer
|
237
|
-
t.column :author_id, :integer
|
238
|
-
end
|
239
|
-
|
240
|
-
add_column :posts, :taggings_count, :integer, :default => 0
|
241
|
-
add_column :authors, :author_address_id, :integer
|
242
|
-
|
243
|
-
create_table :author_addresses, :force => true do |t|
|
244
|
-
t.column :author_address_id, :integer
|
245
|
-
end
|
246
|
-
|
247
|
-
create_table :author_favorites, :force => true do |t|
|
248
|
-
t.column :author_id, :integer
|
249
|
-
t.column :favorite_author_id, :integer
|
250
|
-
end
|
251
|
-
|
252
|
-
create_table :vertices, :force => true do |t|
|
253
|
-
t.column :label, :string
|
254
|
-
end
|
255
|
-
|
256
|
-
create_table :edges, :force => true do |t|
|
257
|
-
t.column :source_id, :integer, :null => false
|
258
|
-
t.column :sink_id, :integer, :null => false
|
259
|
-
end
|
260
|
-
add_index :edges, [:source_id, :sink_id], :unique => true, :name => 'unique_edge_index'
|
261
|
-
|
262
|
-
create_table :lock_without_defaults, :force => true do |t|
|
263
|
-
t.column :lock_version, :integer
|
264
|
-
end
|
265
|
-
|
266
|
-
create_table :lock_without_defaults_cust, :force => true do |t|
|
267
|
-
t.column :custom_lock_version, :integer
|
268
|
-
end
|
269
|
-
|
270
|
-
if adapter_name == 'IBM_DB'
|
271
|
-
create_table :items, :force => true do |t|
|
272
|
-
t.column :name, :string
|
273
|
-
end
|
274
|
-
else
|
275
|
-
create_table :items, :force => true do |t|
|
276
|
-
t.column :name, :integer
|
277
|
-
end
|
278
|
-
end
|
279
|
-
|
280
|
-
|
281
|
-
# For sqlite 3.1.0+, make a table with a autoincrement column
|
282
|
-
if adapter_name == 'SQLite' and supports_autoincrement?
|
283
|
-
create_table :table_with_autoincrement, :force => true do |t|
|
284
|
-
t.column :name, :string
|
285
|
-
end
|
286
|
-
end
|
287
|
-
|
288
|
-
# For sqlserver 2000+, ensure real columns can be used
|
289
|
-
if adapter_name.starts_with?("SQLServer")
|
290
|
-
create_table :table_with_real_columns, :force => true do |t|
|
291
|
-
t.column :real_number, :real
|
292
|
-
end
|
293
|
-
end
|
294
|
-
|
295
|
-
create_table :audit_logs, :force => true do |t|
|
296
|
-
t.column :message, :string, :null=>false
|
297
|
-
t.column :developer_id, :integer, :null=>false
|
298
|
-
end
|
299
|
-
|
300
|
-
create_table :books, :force => true do |t|
|
301
|
-
t.column :name, :string
|
302
|
-
end
|
303
|
-
|
304
|
-
create_table :citations, :force => true do |t|
|
305
|
-
t.column :book1_id, :integer
|
306
|
-
t.column :book2_id, :integer
|
307
|
-
end
|
308
|
-
|
309
|
-
create_table :inept_wizards, :force => true do |t|
|
310
|
-
t.column :name, :string, :null => false
|
311
|
-
t.column :city, :string, :null => false
|
312
|
-
t.column :type, :string
|
313
|
-
end
|
314
|
-
|
315
|
-
create_table :parrots, :force => true do |t|
|
316
|
-
t.column :name, :string
|
317
|
-
t.column :parrot_sti_class, :string
|
318
|
-
t.column :killer_id, :integer
|
319
|
-
t.column :created_at, :datetime
|
320
|
-
t.column :created_on, :datetime
|
321
|
-
t.column :updated_at, :datetime
|
322
|
-
t.column :updated_on, :datetime
|
323
|
-
end
|
324
|
-
|
325
|
-
create_table :pirates, :force => true do |t|
|
326
|
-
t.column :catchphrase, :string
|
327
|
-
t.column :parrot_id, :integer
|
328
|
-
t.column :created_on, :datetime
|
329
|
-
t.column :updated_on, :datetime
|
330
|
-
end
|
331
|
-
|
332
|
-
create_table :parrots_pirates, :id => false, :force => true do |t|
|
333
|
-
t.column :parrot_id, :integer
|
334
|
-
t.column :pirate_id, :integer
|
335
|
-
end
|
336
|
-
|
337
|
-
create_table :treasures, :force => true do |t|
|
338
|
-
t.column :name, :string
|
339
|
-
t.column :looter_id, :integer
|
340
|
-
t.column :looter_type, :string
|
341
|
-
end
|
342
|
-
|
343
|
-
create_table :parrots_treasures, :id => false, :force => true do |t|
|
344
|
-
t.column :parrot_id, :integer
|
345
|
-
t.column :treasure_id, :integer
|
346
|
-
end
|
347
|
-
|
348
|
-
create_table :mateys, :id => false, :force => true do |t|
|
349
|
-
t.column :pirate_id, :integer
|
350
|
-
t.column :target_id, :integer
|
351
|
-
t.column :weight, :integer
|
352
|
-
end
|
353
|
-
|
354
|
-
create_table :ships, :force => true do |t|
|
355
|
-
t.string :name
|
356
|
-
t.datetime :created_at
|
357
|
-
t.datetime :created_on
|
358
|
-
t.datetime :updated_at
|
359
|
-
t.datetime :updated_on
|
360
|
-
end
|
361
|
-
end
|