activerecord_authorails 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (270) hide show
  1. data/CHANGELOG +3043 -0
  2. data/README +360 -0
  3. data/RUNNING_UNIT_TESTS +64 -0
  4. data/Rakefile +226 -0
  5. data/examples/associations.png +0 -0
  6. data/examples/associations.rb +87 -0
  7. data/examples/shared_setup.rb +15 -0
  8. data/examples/validation.rb +85 -0
  9. data/install.rb +30 -0
  10. data/lib/active_record.rb +85 -0
  11. data/lib/active_record/acts/list.rb +244 -0
  12. data/lib/active_record/acts/nested_set.rb +211 -0
  13. data/lib/active_record/acts/tree.rb +89 -0
  14. data/lib/active_record/aggregations.rb +191 -0
  15. data/lib/active_record/associations.rb +1637 -0
  16. data/lib/active_record/associations/association_collection.rb +190 -0
  17. data/lib/active_record/associations/association_proxy.rb +158 -0
  18. data/lib/active_record/associations/belongs_to_association.rb +56 -0
  19. data/lib/active_record/associations/belongs_to_polymorphic_association.rb +50 -0
  20. data/lib/active_record/associations/has_and_belongs_to_many_association.rb +169 -0
  21. data/lib/active_record/associations/has_many_association.rb +210 -0
  22. data/lib/active_record/associations/has_many_through_association.rb +247 -0
  23. data/lib/active_record/associations/has_one_association.rb +80 -0
  24. data/lib/active_record/attribute_methods.rb +75 -0
  25. data/lib/active_record/base.rb +2164 -0
  26. data/lib/active_record/calculations.rb +270 -0
  27. data/lib/active_record/callbacks.rb +367 -0
  28. data/lib/active_record/connection_adapters/abstract/connection_specification.rb +279 -0
  29. data/lib/active_record/connection_adapters/abstract/database_statements.rb +130 -0
  30. data/lib/active_record/connection_adapters/abstract/quoting.rb +58 -0
  31. data/lib/active_record/connection_adapters/abstract/schema_definitions.rb +343 -0
  32. data/lib/active_record/connection_adapters/abstract/schema_statements.rb +310 -0
  33. data/lib/active_record/connection_adapters/abstract_adapter.rb +161 -0
  34. data/lib/active_record/connection_adapters/db2_adapter.rb +228 -0
  35. data/lib/active_record/connection_adapters/firebird_adapter.rb +728 -0
  36. data/lib/active_record/connection_adapters/frontbase_adapter.rb +861 -0
  37. data/lib/active_record/connection_adapters/mysql_adapter.rb +414 -0
  38. data/lib/active_record/connection_adapters/openbase_adapter.rb +350 -0
  39. data/lib/active_record/connection_adapters/oracle_adapter.rb +689 -0
  40. data/lib/active_record/connection_adapters/postgresql_adapter.rb +584 -0
  41. data/lib/active_record/connection_adapters/sqlite_adapter.rb +407 -0
  42. data/lib/active_record/connection_adapters/sqlserver_adapter.rb +591 -0
  43. data/lib/active_record/connection_adapters/sybase_adapter.rb +662 -0
  44. data/lib/active_record/deprecated_associations.rb +104 -0
  45. data/lib/active_record/deprecated_finders.rb +44 -0
  46. data/lib/active_record/fixtures.rb +628 -0
  47. data/lib/active_record/locking/optimistic.rb +106 -0
  48. data/lib/active_record/locking/pessimistic.rb +77 -0
  49. data/lib/active_record/migration.rb +394 -0
  50. data/lib/active_record/observer.rb +178 -0
  51. data/lib/active_record/query_cache.rb +64 -0
  52. data/lib/active_record/reflection.rb +222 -0
  53. data/lib/active_record/schema.rb +58 -0
  54. data/lib/active_record/schema_dumper.rb +149 -0
  55. data/lib/active_record/timestamp.rb +51 -0
  56. data/lib/active_record/transactions.rb +136 -0
  57. data/lib/active_record/validations.rb +843 -0
  58. data/lib/active_record/vendor/db2.rb +362 -0
  59. data/lib/active_record/vendor/mysql.rb +1214 -0
  60. data/lib/active_record/vendor/simple.rb +693 -0
  61. data/lib/active_record/version.rb +9 -0
  62. data/lib/active_record/wrappers/yaml_wrapper.rb +15 -0
  63. data/lib/active_record/wrappings.rb +58 -0
  64. data/lib/active_record/xml_serialization.rb +308 -0
  65. data/test/aaa_create_tables_test.rb +59 -0
  66. data/test/abstract_unit.rb +77 -0
  67. data/test/active_schema_test_mysql.rb +31 -0
  68. data/test/adapter_test.rb +87 -0
  69. data/test/adapter_test_sqlserver.rb +81 -0
  70. data/test/aggregations_test.rb +95 -0
  71. data/test/all.sh +8 -0
  72. data/test/ar_schema_test.rb +33 -0
  73. data/test/association_inheritance_reload.rb +14 -0
  74. data/test/associations/callbacks_test.rb +126 -0
  75. data/test/associations/cascaded_eager_loading_test.rb +138 -0
  76. data/test/associations/eager_test.rb +393 -0
  77. data/test/associations/extension_test.rb +42 -0
  78. data/test/associations/join_model_test.rb +497 -0
  79. data/test/associations_test.rb +1809 -0
  80. data/test/attribute_methods_test.rb +49 -0
  81. data/test/base_test.rb +1586 -0
  82. data/test/binary_test.rb +37 -0
  83. data/test/calculations_test.rb +219 -0
  84. data/test/callbacks_test.rb +377 -0
  85. data/test/class_inheritable_attributes_test.rb +32 -0
  86. data/test/column_alias_test.rb +17 -0
  87. data/test/connection_test_firebird.rb +8 -0
  88. data/test/connections/native_db2/connection.rb +25 -0
  89. data/test/connections/native_firebird/connection.rb +26 -0
  90. data/test/connections/native_frontbase/connection.rb +27 -0
  91. data/test/connections/native_mysql/connection.rb +24 -0
  92. data/test/connections/native_openbase/connection.rb +21 -0
  93. data/test/connections/native_oracle/connection.rb +27 -0
  94. data/test/connections/native_postgresql/connection.rb +23 -0
  95. data/test/connections/native_sqlite/connection.rb +34 -0
  96. data/test/connections/native_sqlite3/connection.rb +34 -0
  97. data/test/connections/native_sqlite3/in_memory_connection.rb +18 -0
  98. data/test/connections/native_sqlserver/connection.rb +23 -0
  99. data/test/connections/native_sqlserver_odbc/connection.rb +25 -0
  100. data/test/connections/native_sybase/connection.rb +23 -0
  101. data/test/copy_table_sqlite.rb +64 -0
  102. data/test/datatype_test_postgresql.rb +52 -0
  103. data/test/default_test_firebird.rb +16 -0
  104. data/test/defaults_test.rb +60 -0
  105. data/test/deprecated_associations_test.rb +396 -0
  106. data/test/deprecated_finder_test.rb +151 -0
  107. data/test/empty_date_time_test.rb +25 -0
  108. data/test/finder_test.rb +504 -0
  109. data/test/fixtures/accounts.yml +28 -0
  110. data/test/fixtures/author.rb +99 -0
  111. data/test/fixtures/author_favorites.yml +4 -0
  112. data/test/fixtures/authors.yml +7 -0
  113. data/test/fixtures/auto_id.rb +4 -0
  114. data/test/fixtures/bad_fixtures/attr_with_numeric_first_char +1 -0
  115. data/test/fixtures/bad_fixtures/attr_with_spaces +1 -0
  116. data/test/fixtures/bad_fixtures/blank_line +3 -0
  117. data/test/fixtures/bad_fixtures/duplicate_attributes +3 -0
  118. data/test/fixtures/bad_fixtures/missing_value +1 -0
  119. data/test/fixtures/binary.rb +2 -0
  120. data/test/fixtures/categories.yml +14 -0
  121. data/test/fixtures/categories/special_categories.yml +9 -0
  122. data/test/fixtures/categories/subsubdir/arbitrary_filename.yml +4 -0
  123. data/test/fixtures/categories_ordered.yml +7 -0
  124. data/test/fixtures/categories_posts.yml +23 -0
  125. data/test/fixtures/categorization.rb +5 -0
  126. data/test/fixtures/categorizations.yml +17 -0
  127. data/test/fixtures/category.rb +20 -0
  128. data/test/fixtures/column_name.rb +3 -0
  129. data/test/fixtures/comment.rb +23 -0
  130. data/test/fixtures/comments.yml +59 -0
  131. data/test/fixtures/companies.yml +55 -0
  132. data/test/fixtures/company.rb +107 -0
  133. data/test/fixtures/company_in_module.rb +59 -0
  134. data/test/fixtures/computer.rb +3 -0
  135. data/test/fixtures/computers.yml +4 -0
  136. data/test/fixtures/course.rb +3 -0
  137. data/test/fixtures/courses.yml +7 -0
  138. data/test/fixtures/customer.rb +55 -0
  139. data/test/fixtures/customers.yml +17 -0
  140. data/test/fixtures/db_definitions/db2.drop.sql +32 -0
  141. data/test/fixtures/db_definitions/db2.sql +231 -0
  142. data/test/fixtures/db_definitions/db22.drop.sql +2 -0
  143. data/test/fixtures/db_definitions/db22.sql +5 -0
  144. data/test/fixtures/db_definitions/firebird.drop.sql +63 -0
  145. data/test/fixtures/db_definitions/firebird.sql +304 -0
  146. data/test/fixtures/db_definitions/firebird2.drop.sql +2 -0
  147. data/test/fixtures/db_definitions/firebird2.sql +6 -0
  148. data/test/fixtures/db_definitions/frontbase.drop.sql +32 -0
  149. data/test/fixtures/db_definitions/frontbase.sql +268 -0
  150. data/test/fixtures/db_definitions/frontbase2.drop.sql +1 -0
  151. data/test/fixtures/db_definitions/frontbase2.sql +4 -0
  152. data/test/fixtures/db_definitions/mysql.drop.sql +32 -0
  153. data/test/fixtures/db_definitions/mysql.sql +234 -0
  154. data/test/fixtures/db_definitions/mysql2.drop.sql +2 -0
  155. data/test/fixtures/db_definitions/mysql2.sql +5 -0
  156. data/test/fixtures/db_definitions/openbase.drop.sql +2 -0
  157. data/test/fixtures/db_definitions/openbase.sql +302 -0
  158. data/test/fixtures/db_definitions/openbase2.drop.sql +2 -0
  159. data/test/fixtures/db_definitions/openbase2.sql +7 -0
  160. data/test/fixtures/db_definitions/oracle.drop.sql +65 -0
  161. data/test/fixtures/db_definitions/oracle.sql +325 -0
  162. data/test/fixtures/db_definitions/oracle2.drop.sql +2 -0
  163. data/test/fixtures/db_definitions/oracle2.sql +6 -0
  164. data/test/fixtures/db_definitions/postgresql.drop.sql +37 -0
  165. data/test/fixtures/db_definitions/postgresql.sql +263 -0
  166. data/test/fixtures/db_definitions/postgresql2.drop.sql +2 -0
  167. data/test/fixtures/db_definitions/postgresql2.sql +5 -0
  168. data/test/fixtures/db_definitions/schema.rb +60 -0
  169. data/test/fixtures/db_definitions/sqlite.drop.sql +32 -0
  170. data/test/fixtures/db_definitions/sqlite.sql +215 -0
  171. data/test/fixtures/db_definitions/sqlite2.drop.sql +2 -0
  172. data/test/fixtures/db_definitions/sqlite2.sql +5 -0
  173. data/test/fixtures/db_definitions/sqlserver.drop.sql +34 -0
  174. data/test/fixtures/db_definitions/sqlserver.sql +243 -0
  175. data/test/fixtures/db_definitions/sqlserver2.drop.sql +2 -0
  176. data/test/fixtures/db_definitions/sqlserver2.sql +5 -0
  177. data/test/fixtures/db_definitions/sybase.drop.sql +34 -0
  178. data/test/fixtures/db_definitions/sybase.sql +218 -0
  179. data/test/fixtures/db_definitions/sybase2.drop.sql +4 -0
  180. data/test/fixtures/db_definitions/sybase2.sql +5 -0
  181. data/test/fixtures/default.rb +2 -0
  182. data/test/fixtures/developer.rb +52 -0
  183. data/test/fixtures/developers.yml +21 -0
  184. data/test/fixtures/developers_projects.yml +17 -0
  185. data/test/fixtures/developers_projects/david_action_controller +3 -0
  186. data/test/fixtures/developers_projects/david_active_record +3 -0
  187. data/test/fixtures/developers_projects/jamis_active_record +2 -0
  188. data/test/fixtures/edge.rb +5 -0
  189. data/test/fixtures/edges.yml +6 -0
  190. data/test/fixtures/entrant.rb +3 -0
  191. data/test/fixtures/entrants.yml +14 -0
  192. data/test/fixtures/fk_test_has_fk.yml +3 -0
  193. data/test/fixtures/fk_test_has_pk.yml +2 -0
  194. data/test/fixtures/flowers.jpg +0 -0
  195. data/test/fixtures/funny_jokes.yml +10 -0
  196. data/test/fixtures/joke.rb +6 -0
  197. data/test/fixtures/keyboard.rb +3 -0
  198. data/test/fixtures/legacy_thing.rb +3 -0
  199. data/test/fixtures/legacy_things.yml +3 -0
  200. data/test/fixtures/migrations/1_people_have_last_names.rb +9 -0
  201. data/test/fixtures/migrations/2_we_need_reminders.rb +12 -0
  202. data/test/fixtures/migrations/3_innocent_jointable.rb +12 -0
  203. data/test/fixtures/migrations_with_decimal/1_give_me_big_numbers.rb +15 -0
  204. data/test/fixtures/migrations_with_duplicate/1_people_have_last_names.rb +9 -0
  205. data/test/fixtures/migrations_with_duplicate/2_we_need_reminders.rb +12 -0
  206. data/test/fixtures/migrations_with_duplicate/3_foo.rb +7 -0
  207. data/test/fixtures/migrations_with_duplicate/3_innocent_jointable.rb +12 -0
  208. data/test/fixtures/migrations_with_missing_versions/1000_people_have_middle_names.rb +9 -0
  209. data/test/fixtures/migrations_with_missing_versions/1_people_have_last_names.rb +9 -0
  210. data/test/fixtures/migrations_with_missing_versions/3_we_need_reminders.rb +12 -0
  211. data/test/fixtures/migrations_with_missing_versions/4_innocent_jointable.rb +12 -0
  212. data/test/fixtures/mixed_case_monkey.rb +3 -0
  213. data/test/fixtures/mixed_case_monkeys.yml +6 -0
  214. data/test/fixtures/mixin.rb +63 -0
  215. data/test/fixtures/mixins.yml +127 -0
  216. data/test/fixtures/movie.rb +5 -0
  217. data/test/fixtures/movies.yml +7 -0
  218. data/test/fixtures/naked/csv/accounts.csv +1 -0
  219. data/test/fixtures/naked/yml/accounts.yml +1 -0
  220. data/test/fixtures/naked/yml/companies.yml +1 -0
  221. data/test/fixtures/naked/yml/courses.yml +1 -0
  222. data/test/fixtures/order.rb +4 -0
  223. data/test/fixtures/people.yml +3 -0
  224. data/test/fixtures/person.rb +4 -0
  225. data/test/fixtures/post.rb +58 -0
  226. data/test/fixtures/posts.yml +48 -0
  227. data/test/fixtures/project.rb +27 -0
  228. data/test/fixtures/projects.yml +7 -0
  229. data/test/fixtures/reader.rb +4 -0
  230. data/test/fixtures/readers.yml +4 -0
  231. data/test/fixtures/reply.rb +37 -0
  232. data/test/fixtures/subject.rb +4 -0
  233. data/test/fixtures/subscriber.rb +6 -0
  234. data/test/fixtures/subscribers/first +2 -0
  235. data/test/fixtures/subscribers/second +2 -0
  236. data/test/fixtures/tag.rb +7 -0
  237. data/test/fixtures/tagging.rb +6 -0
  238. data/test/fixtures/taggings.yml +18 -0
  239. data/test/fixtures/tags.yml +7 -0
  240. data/test/fixtures/task.rb +3 -0
  241. data/test/fixtures/tasks.yml +7 -0
  242. data/test/fixtures/topic.rb +25 -0
  243. data/test/fixtures/topics.yml +22 -0
  244. data/test/fixtures/vertex.rb +9 -0
  245. data/test/fixtures/vertices.yml +4 -0
  246. data/test/fixtures_test.rb +401 -0
  247. data/test/inheritance_test.rb +205 -0
  248. data/test/lifecycle_test.rb +137 -0
  249. data/test/locking_test.rb +190 -0
  250. data/test/method_scoping_test.rb +416 -0
  251. data/test/migration_test.rb +768 -0
  252. data/test/migration_test_firebird.rb +124 -0
  253. data/test/mixin_nested_set_test.rb +196 -0
  254. data/test/mixin_test.rb +550 -0
  255. data/test/modules_test.rb +34 -0
  256. data/test/multiple_db_test.rb +60 -0
  257. data/test/pk_test.rb +104 -0
  258. data/test/readonly_test.rb +107 -0
  259. data/test/reflection_test.rb +159 -0
  260. data/test/schema_authorization_test_postgresql.rb +75 -0
  261. data/test/schema_dumper_test.rb +96 -0
  262. data/test/schema_test_postgresql.rb +64 -0
  263. data/test/synonym_test_oracle.rb +17 -0
  264. data/test/table_name_test_sqlserver.rb +23 -0
  265. data/test/threaded_connections_test.rb +48 -0
  266. data/test/transactions_test.rb +230 -0
  267. data/test/unconnected_test.rb +32 -0
  268. data/test/validations_test.rb +1097 -0
  269. data/test/xml_serialization_test.rb +125 -0
  270. metadata +365 -0
@@ -0,0 +1,304 @@
1
+ CREATE DOMAIN D_BOOLEAN AS SMALLINT CHECK (VALUE IN (0, 1) OR VALUE IS NULL);
2
+
3
+ CREATE TABLE accounts (
4
+ id BIGINT NOT NULL,
5
+ firm_id BIGINT,
6
+ credit_limit INTEGER,
7
+ PRIMARY KEY (id)
8
+ );
9
+ CREATE GENERATOR accounts_seq;
10
+ SET GENERATOR accounts_seq TO 10000;
11
+
12
+ CREATE TABLE funny_jokes (
13
+ id BIGINT NOT NULL,
14
+ name VARCHAR(50),
15
+ PRIMARY KEY (id)
16
+ );
17
+ CREATE GENERATOR funny_jokes_seq;
18
+ SET GENERATOR funny_jokes_seq TO 10000;
19
+
20
+ CREATE TABLE companies (
21
+ id BIGINT NOT NULL,
22
+ "TYPE" VARCHAR(50),
23
+ ruby_type VARCHAR(50),
24
+ firm_id BIGINT,
25
+ name VARCHAR(50),
26
+ client_of INTEGER,
27
+ rating INTEGER DEFAULT 1,
28
+ PRIMARY KEY (id)
29
+ );
30
+ CREATE GENERATOR companies_nonstd_seq;
31
+ SET GENERATOR companies_nonstd_seq TO 10000;
32
+
33
+ CREATE TABLE topics (
34
+ id BIGINT NOT NULL,
35
+ title VARCHAR(255),
36
+ author_name VARCHAR(255),
37
+ author_email_address VARCHAR(255),
38
+ written_on TIMESTAMP,
39
+ bonus_time TIME,
40
+ last_read DATE,
41
+ content VARCHAR(4000),
42
+ approved D_BOOLEAN DEFAULT 1,
43
+ replies_count INTEGER DEFAULT 0,
44
+ parent_id BIGINT,
45
+ "TYPE" VARCHAR(50),
46
+ PRIMARY KEY (id)
47
+ );
48
+ CREATE GENERATOR topics_seq;
49
+ SET GENERATOR topics_seq TO 10000;
50
+
51
+ CREATE TABLE developers (
52
+ id BIGINT NOT NULL,
53
+ name VARCHAR(100),
54
+ salary INTEGER DEFAULT 70000,
55
+ created_at TIMESTAMP,
56
+ updated_at TIMESTAMP,
57
+ PRIMARY KEY (id)
58
+ );
59
+ CREATE GENERATOR developers_seq;
60
+ SET GENERATOR developers_seq TO 10000;
61
+
62
+ CREATE TABLE projects (
63
+ id BIGINT NOT NULL,
64
+ name VARCHAR(100),
65
+ "TYPE" VARCHAR(255),
66
+ PRIMARY KEY (id)
67
+ );
68
+ CREATE GENERATOR projects_seq;
69
+ SET GENERATOR projects_seq TO 10000;
70
+
71
+ CREATE TABLE developers_projects (
72
+ developer_id BIGINT NOT NULL,
73
+ project_id BIGINT NOT NULL,
74
+ joined_on DATE,
75
+ access_level SMALLINT DEFAULT 1
76
+ );
77
+
78
+ CREATE TABLE orders (
79
+ id BIGINT NOT NULL,
80
+ name VARCHAR(100),
81
+ billing_customer_id BIGINT,
82
+ shipping_customer_id BIGINT,
83
+ PRIMARY KEY (id)
84
+ );
85
+ CREATE GENERATOR orders_seq;
86
+ SET GENERATOR orders_seq TO 10000;
87
+
88
+ CREATE TABLE customers (
89
+ id BIGINT NOT NULL,
90
+ name VARCHAR(100),
91
+ balance INTEGER DEFAULT 0,
92
+ address_street VARCHAR(100),
93
+ address_city VARCHAR(100),
94
+ address_country VARCHAR(100),
95
+ gps_location VARCHAR(100),
96
+ PRIMARY KEY (id)
97
+ );
98
+ CREATE GENERATOR customers_seq;
99
+ SET GENERATOR customers_seq TO 10000;
100
+
101
+ CREATE TABLE movies (
102
+ movieid BIGINT NOT NULL,
103
+ name varchar(100),
104
+ PRIMARY KEY (movieid)
105
+ );
106
+ CREATE GENERATOR movies_seq;
107
+ SET GENERATOR movies_seq TO 10000;
108
+
109
+ CREATE TABLE subscribers (
110
+ nick VARCHAR(100) NOT NULL,
111
+ name VARCHAR(100),
112
+ PRIMARY KEY (nick)
113
+ );
114
+
115
+ CREATE TABLE booleantests (
116
+ id BIGINT NOT NULL,
117
+ "VALUE" D_BOOLEAN,
118
+ PRIMARY KEY (id)
119
+ );
120
+ CREATE GENERATOR booleantests_seq;
121
+ SET GENERATOR booleantests_seq TO 10000;
122
+
123
+ CREATE TABLE auto_id_tests (
124
+ auto_id BIGINT NOT NULL,
125
+ "VALUE" INTEGER,
126
+ PRIMARY KEY (auto_id)
127
+ );
128
+ CREATE GENERATOR auto_id_tests_seq;
129
+ SET GENERATOR auto_id_tests_seq TO 10000;
130
+
131
+ CREATE TABLE entrants (
132
+ id BIGINT NOT NULL,
133
+ name VARCHAR(255) NOT NULL,
134
+ course_id INTEGER NOT NULL,
135
+ PRIMARY KEY (id)
136
+ );
137
+ CREATE GENERATOR entrants_seq;
138
+ SET GENERATOR entrants_seq TO 10000;
139
+
140
+ CREATE TABLE colnametests (
141
+ id BIGINT NOT NULL,
142
+ "REFERENCES" INTEGER NOT NULL,
143
+ PRIMARY KEY (id)
144
+ );
145
+ CREATE GENERATOR colnametests_seq;
146
+ SET GENERATOR colnametests_seq TO 10000;
147
+
148
+ CREATE TABLE mixins (
149
+ id BIGINT NOT NULL,
150
+ parent_id BIGINT,
151
+ pos INTEGER,
152
+ created_at TIMESTAMP,
153
+ updated_at TIMESTAMP,
154
+ lft INTEGER,
155
+ rgt INTEGER,
156
+ root_id BIGINT,
157
+ "TYPE" VARCHAR(40),
158
+ PRIMARY KEY (id)
159
+ );
160
+ CREATE GENERATOR mixins_seq;
161
+ SET GENERATOR mixins_seq TO 10000;
162
+
163
+ CREATE TABLE people (
164
+ id BIGINT NOT NULL,
165
+ first_name VARCHAR(40),
166
+ lock_version INTEGER DEFAULT 0 NOT NULL,
167
+ PRIMARY KEY (id)
168
+ );
169
+ CREATE GENERATOR people_seq;
170
+ SET GENERATOR people_seq TO 10000;
171
+
172
+ CREATE TABLE readers (
173
+ id BIGINT NOT NULL,
174
+ post_id BIGINT NOT NULL,
175
+ person_id BIGINT NOT NULL,
176
+ PRIMARY KEY (id)
177
+ );
178
+ CREATE GENERATOR readers_seq;
179
+ SET GENERATOR readers_seq TO 10000;
180
+
181
+ CREATE TABLE binaries (
182
+ id BIGINT NOT NULL,
183
+ data BLOB,
184
+ PRIMARY KEY (id)
185
+ );
186
+ CREATE GENERATOR binaries_seq;
187
+ SET GENERATOR binaries_seq TO 10000;
188
+
189
+ CREATE TABLE computers (
190
+ id BIGINT NOT NULL,
191
+ developer INTEGER NOT NULL,
192
+ "extendedWarranty" INTEGER NOT NULL,
193
+ PRIMARY KEY (id)
194
+ );
195
+ CREATE GENERATOR computers_seq;
196
+ SET GENERATOR computers_seq TO 10000;
197
+
198
+ CREATE TABLE posts (
199
+ id BIGINT NOT NULL,
200
+ author_id BIGINT,
201
+ title VARCHAR(255) NOT NULL,
202
+ "TYPE" VARCHAR(255) NOT NULL,
203
+ body VARCHAR(3000) NOT NULL,
204
+ PRIMARY KEY (id)
205
+ );
206
+ CREATE GENERATOR posts_seq;
207
+ SET GENERATOR posts_seq TO 10000;
208
+
209
+ CREATE TABLE comments (
210
+ id BIGINT NOT NULL,
211
+ post_id BIGINT NOT NULL,
212
+ "TYPE" VARCHAR(255) NOT NULL,
213
+ body VARCHAR(3000) NOT NULL,
214
+ PRIMARY KEY (id)
215
+ );
216
+ CREATE GENERATOR comments_seq;
217
+ SET GENERATOR comments_seq TO 10000;
218
+
219
+ CREATE TABLE authors (
220
+ id BIGINT NOT NULL,
221
+ name VARCHAR(255) NOT NULL,
222
+ PRIMARY KEY (id)
223
+ );
224
+ CREATE GENERATOR authors_seq;
225
+ SET GENERATOR authors_seq TO 10000;
226
+
227
+ CREATE TABLE tasks (
228
+ id BIGINT NOT NULL,
229
+ "STARTING" TIMESTAMP,
230
+ ending TIMESTAMP,
231
+ PRIMARY KEY (id)
232
+ );
233
+ CREATE GENERATOR tasks_seq;
234
+ SET GENERATOR tasks_seq TO 10000;
235
+
236
+ CREATE TABLE categories (
237
+ id BIGINT NOT NULL,
238
+ name VARCHAR(255) NOT NULL,
239
+ "TYPE" VARCHAR(255) NOT NULL,
240
+ PRIMARY KEY (id)
241
+ );
242
+ CREATE GENERATOR categories_seq;
243
+ SET GENERATOR categories_seq TO 10000;
244
+
245
+ CREATE TABLE categories_posts (
246
+ category_id BIGINT NOT NULL,
247
+ post_id BIGINT NOT NULL,
248
+ PRIMARY KEY (category_id, post_id)
249
+ );
250
+
251
+ CREATE TABLE fk_test_has_pk (
252
+ id BIGINT NOT NULL,
253
+ PRIMARY KEY (id)
254
+ );
255
+
256
+ CREATE TABLE fk_test_has_fk (
257
+ id BIGINT NOT NULL,
258
+ fk_id BIGINT NOT NULL,
259
+ PRIMARY KEY (id),
260
+ FOREIGN KEY (fk_id) REFERENCES fk_test_has_pk(id)
261
+ );
262
+
263
+ CREATE TABLE keyboards (
264
+ key_number BIGINT NOT NULL,
265
+ name VARCHAR(50),
266
+ PRIMARY KEY (key_number)
267
+ );
268
+ CREATE GENERATOR keyboards_seq;
269
+ SET GENERATOR keyboards_seq TO 10000;
270
+
271
+ CREATE TABLE defaults (
272
+ id BIGINT NOT NULL,
273
+ default_timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP
274
+ );
275
+ CREATE GENERATOR defaults_seq;
276
+ SET GENERATOR defaults_seq TO 10000;
277
+
278
+ CREATE TABLE legacy_things (
279
+ id BIGINT NOT NULL,
280
+ tps_report_number INTEGER,
281
+ version INTEGER DEFAULT 0 NOT NULL,
282
+ PRIMARY KEY (id)
283
+ );
284
+ CREATE GENERATOR legacy_things_seq;
285
+ SET GENERATOR legacy_things_seq TO 10000;
286
+
287
+ CREATE TABLE numeric_data (
288
+ id BIGINT NOT NULL,
289
+ bank_balance DECIMAL(10,2),
290
+ big_bank_balance DECIMAL(15,2),
291
+ world_population DECIMAL(10),
292
+ my_house_population DECIMAL(2),
293
+ decimal_number_with_default DECIMAL(3,2) DEFAULT 2.78,
294
+ PRIMARY KEY (id)
295
+ );
296
+ CREATE GENERATOR numeric_data_seq;
297
+ SET GENERATOR numeric_data_seq TO 10000;
298
+
299
+ CREATE TABLE mixed_case_monkeys (
300
+ "monkeyID" BIGINT NOT NULL,
301
+ "fleaCount" INTEGER
302
+ );
303
+ CREATE GENERATOR mixed_case_monkeys_seq;
304
+ SET GENERATOR mixed_case_monkeys_seq TO 10000;
@@ -0,0 +1,2 @@
1
+ DROP TABLE courses;
2
+ DROP GENERATOR courses_seq;
@@ -0,0 +1,6 @@
1
+ CREATE TABLE courses (
2
+ id BIGINT NOT NULL PRIMARY KEY,
3
+ name VARCHAR(255) NOT NULL
4
+ );
5
+ CREATE GENERATOR courses_seq;
6
+ SET GENERATOR courses_seq TO 10000;
@@ -0,0 +1,32 @@
1
+ DROP TABLE accounts CASCADE;
2
+ DROP TABLE funny_jokes CASCADE;
3
+ DROP TABLE companies CASCADE;
4
+ DROP TABLE topics CASCADE;
5
+ DROP TABLE developers CASCADE;
6
+ DROP TABLE projects CASCADE;
7
+ DROP TABLE developers_projects CASCADE;
8
+ DROP TABLE orders CASCADE;
9
+ DROP TABLE customers CASCADE;
10
+ DROP TABLE movies CASCADE;
11
+ DROP TABLE subscribers CASCADE;
12
+ DROP TABLE booleantests CASCADE;
13
+ DROP TABLE auto_id_tests CASCADE;
14
+ DROP TABLE entrants CASCADE;
15
+ DROP TABLE colnametests CASCADE;
16
+ DROP TABLE mixins CASCADE;
17
+ DROP TABLE people CASCADE;
18
+ DROP TABLE readers CASCADE;
19
+ DROP TABLE binaries CASCADE;
20
+ DROP TABLE computers CASCADE;
21
+ DROP TABLE posts CASCADE;
22
+ DROP TABLE comments CASCADE;
23
+ DROP TABLE authors CASCADE;
24
+ DROP TABLE tasks CASCADE;
25
+ DROP TABLE categories CASCADE;
26
+ DROP TABLE categories_posts CASCADE;
27
+ DROP TABLE fk_test_has_fk CASCADE;
28
+ DROP TABLE fk_test_has_pk CASCADE;
29
+ DROP TABLE keyboards CASCADE;
30
+ DROP TABLE legacy_things CASCADE;
31
+ DROP TABLE numeric_data CASCADE;
32
+ DROP TABLE mixed_case_monkeys CASCADE;
@@ -0,0 +1,268 @@
1
+ CREATE TABLE accounts (
2
+ id integer DEFAULT unique,
3
+ firm_id integer,
4
+ credit_limit integer,
5
+ PRIMARY KEY (id)
6
+ );
7
+ SET UNIQUE FOR accounts(id);
8
+
9
+ CREATE TABLE funny_jokes (
10
+ id integer DEFAULT unique,
11
+ firm_id integer default NULL,
12
+ name character varying(50),
13
+ PRIMARY KEY (id)
14
+ );
15
+ SET UNIQUE FOR funny_jokes(id);
16
+
17
+ CREATE TABLE companies (
18
+ id integer DEFAULT unique,
19
+ "type" character varying(50),
20
+ "ruby_type" character varying(50),
21
+ firm_id integer,
22
+ name character varying(50),
23
+ client_of integer,
24
+ rating integer default 1,
25
+ PRIMARY KEY (id)
26
+ );
27
+ SET UNIQUE FOR companies(id);
28
+
29
+ CREATE TABLE topics (
30
+ id integer DEFAULT unique,
31
+ title character varying(255),
32
+ author_name character varying(255),
33
+ author_email_address character varying(255),
34
+ written_on timestamp,
35
+ bonus_time time,
36
+ last_read date,
37
+ content varchar(65536),
38
+ approved boolean default true,
39
+ replies_count integer default 0,
40
+ parent_id integer,
41
+ "type" character varying(50),
42
+ PRIMARY KEY (id)
43
+ );
44
+ SET UNIQUE FOR topics(id);
45
+
46
+ CREATE TABLE developers (
47
+ id integer DEFAULT unique,
48
+ name character varying(100),
49
+ salary integer DEFAULT 70000,
50
+ created_at timestamp,
51
+ updated_at timestamp,
52
+ PRIMARY KEY (id)
53
+ );
54
+ SET UNIQUE FOR developers(id);
55
+
56
+ CREATE TABLE projects (
57
+ id integer DEFAULT unique,
58
+ name character varying(100),
59
+ type varchar(255),
60
+ PRIMARY KEY (id)
61
+ );
62
+ SET UNIQUE FOR projects(id);
63
+
64
+ CREATE TABLE developers_projects (
65
+ developer_id integer NOT NULL,
66
+ project_id integer NOT NULL,
67
+ joined_on date,
68
+ access_level integer default 1
69
+ );
70
+
71
+ CREATE TABLE orders (
72
+ id integer DEFAULT unique,
73
+ name character varying(100),
74
+ billing_customer_id integer,
75
+ shipping_customer_id integer,
76
+ PRIMARY KEY (id)
77
+ );
78
+ SET UNIQUE FOR orders(id);
79
+
80
+ CREATE TABLE customers (
81
+ id integer DEFAULT unique,
82
+ name character varying(100),
83
+ balance integer default 0,
84
+ address_street character varying(100),
85
+ address_city character varying(100),
86
+ address_country character varying(100),
87
+ gps_location character varying(100),
88
+ PRIMARY KEY (id)
89
+ );
90
+ SET UNIQUE FOR customers(id);
91
+
92
+ CREATE TABLE movies (
93
+ movieid integer DEFAULT unique,
94
+ name varchar(65536),
95
+ PRIMARY KEY (movieid)
96
+ );
97
+ SET UNIQUE FOR movies(movieid);
98
+
99
+ CREATE TABLE subscribers (
100
+ nick varchar(65536) NOT NULL,
101
+ name varchar(65536),
102
+ PRIMARY KEY (nick)
103
+ );
104
+
105
+ CREATE TABLE booleantests (
106
+ id integer DEFAULT unique,
107
+ value boolean,
108
+ PRIMARY KEY (id)
109
+ );
110
+ SET UNIQUE FOR booleantests(id);
111
+
112
+ CREATE TABLE auto_id_tests (
113
+ auto_id integer DEFAULT unique,
114
+ value integer,
115
+ PRIMARY KEY (auto_id)
116
+ );
117
+ SET UNIQUE FOR auto_id_tests(auto_id);
118
+
119
+ CREATE TABLE entrants (
120
+ id integer DEFAULT unique,
121
+ name varchar(65536),
122
+ course_id integer,
123
+ PRIMARY KEY (id)
124
+ );
125
+ SET UNIQUE FOR entrants(id);
126
+
127
+ CREATE TABLE colnametests (
128
+ id integer DEFAULT unique,
129
+ "references" integer NOT NULL,
130
+ PRIMARY KEY (id)
131
+ );
132
+ SET UNIQUE FOR colnametests(id);
133
+
134
+ CREATE TABLE mixins (
135
+ id integer DEFAULT unique,
136
+ parent_id integer,
137
+ type character varying(100),
138
+ pos integer,
139
+ lft integer,
140
+ rgt integer,
141
+ root_id integer,
142
+ created_at timestamp,
143
+ updated_at timestamp,
144
+ PRIMARY KEY (id)
145
+ );
146
+ SET UNIQUE FOR mixins(id);
147
+
148
+ CREATE TABLE people (
149
+ id integer DEFAULT unique,
150
+ first_name varchar(65536),
151
+ lock_version integer default 0,
152
+ PRIMARY KEY (id)
153
+ );
154
+ SET UNIQUE FOR people(id);
155
+
156
+ CREATE TABLE readers (
157
+ id integer DEFAULT unique,
158
+ post_id INTEGER NOT NULL,
159
+ person_id INTEGER NOT NULL,
160
+ PRIMARY KEY (id)
161
+ );
162
+ SET UNIQUE FOR readers(id);
163
+
164
+ CREATE TABLE binaries (
165
+ id integer DEFAULT unique,
166
+ data BLOB,
167
+ PRIMARY KEY (id)
168
+ );
169
+ SET UNIQUE FOR binaries(id);
170
+
171
+ CREATE TABLE computers (
172
+ id integer DEFAULT unique,
173
+ developer integer NOT NULL,
174
+ "extendedWarranty" integer NOT NULL,
175
+ PRIMARY KEY (id)
176
+ );
177
+ SET UNIQUE FOR computers(id);
178
+
179
+ CREATE TABLE posts (
180
+ id integer DEFAULT unique,
181
+ author_id integer,
182
+ title varchar(255),
183
+ type varchar(255),
184
+ body varchar(65536),
185
+ PRIMARY KEY (id)
186
+ );
187
+ SET UNIQUE FOR posts(id);
188
+
189
+ CREATE TABLE comments (
190
+ id integer DEFAULT unique,
191
+ post_id integer,
192
+ type varchar(255),
193
+ body varchar(65536),
194
+ PRIMARY KEY (id)
195
+ );
196
+ SET UNIQUE FOR comments(id);
197
+
198
+ CREATE TABLE authors (
199
+ id integer DEFAULT unique,
200
+ name varchar(255) default NULL,
201
+ PRIMARY KEY (id)
202
+ );
203
+ SET UNIQUE FOR authors(id);
204
+
205
+ CREATE TABLE tasks (
206
+ id integer DEFAULT unique,
207
+ starting timestamp,
208
+ ending timestamp,
209
+ PRIMARY KEY (id)
210
+ );
211
+ SET UNIQUE FOR tasks(id);
212
+
213
+ CREATE TABLE categories (
214
+ id integer DEFAULT unique,
215
+ name varchar(255),
216
+ type varchar(255),
217
+ PRIMARY KEY (id)
218
+ );
219
+ SET UNIQUE FOR categories(id);
220
+
221
+ CREATE TABLE categories_posts (
222
+ category_id integer NOT NULL,
223
+ post_id integer NOT NULL
224
+ );
225
+
226
+ CREATE TABLE fk_test_has_pk (
227
+ id INTEGER NOT NULL PRIMARY KEY
228
+ );
229
+ SET UNIQUE FOR fk_test_has_pk(id);
230
+
231
+ CREATE TABLE fk_test_has_fk (
232
+ id INTEGER NOT NULL PRIMARY KEY,
233
+ fk_id INTEGER NOT NULL REFERENCES fk_test_has_fk(id)
234
+ );
235
+ SET UNIQUE FOR fk_test_has_fk(id);
236
+
237
+ CREATE TABLE keyboards (
238
+ key_number integer DEFAULT unique,
239
+ "name" character varying(50),
240
+ PRIMARY KEY (key_number)
241
+ );
242
+ SET UNIQUE FOR keyboards(key_number);
243
+
244
+ create table "legacy_things"
245
+ (
246
+ "id" int,
247
+ "tps_report_number" int default NULL,
248
+ "version" int default 0 not null,
249
+ primary key ("id")
250
+ );
251
+ SET UNIQUE FOR legacy_things(id);
252
+
253
+ CREATE TABLE "numeric_data" (
254
+ "id" integer NOT NULL
255
+ "bank_balance" DECIMAL(10,2),
256
+ "big_bank_balance" DECIMAL(15,2),
257
+ "world_population" DECIMAL(10),
258
+ "my_house_population" DECIMAL(2),
259
+ "decimal_number_with_default" DECIMAL(3,2) DEFAULT 2.78,
260
+ primary key ("id")
261
+ );
262
+ SET UNIQUE FOR numeric_data(id);
263
+
264
+ CREATE TABLE mixed_case_monkeys (
265
+ "monkeyID" integer DEFAULT unique,
266
+ "fleaCount" integer
267
+ );
268
+ SET UNIQUE FOR mixed_case_monkeys("monkeyID");