activerecord 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activerecord might be problematic. Click here for more details.
- data/CHANGELOG +4928 -3
- data/README +45 -46
- data/RUNNING_UNIT_TESTS +8 -11
- data/Rakefile +247 -0
- data/install.rb +8 -38
- data/lib/active_record/aggregations.rb +64 -49
- data/lib/active_record/associations/association_collection.rb +217 -47
- data/lib/active_record/associations/association_proxy.rb +159 -0
- data/lib/active_record/associations/belongs_to_association.rb +56 -0
- data/lib/active_record/associations/belongs_to_polymorphic_association.rb +50 -0
- data/lib/active_record/associations/has_and_belongs_to_many_association.rb +155 -37
- data/lib/active_record/associations/has_many_association.rb +145 -75
- data/lib/active_record/associations/has_many_through_association.rb +283 -0
- data/lib/active_record/associations/has_one_association.rb +96 -0
- data/lib/active_record/associations.rb +1537 -304
- data/lib/active_record/attribute_methods.rb +328 -0
- data/lib/active_record/base.rb +2001 -588
- data/lib/active_record/calculations.rb +269 -0
- data/lib/active_record/callbacks.rb +169 -165
- data/lib/active_record/connection_adapters/abstract/connection_specification.rb +308 -0
- data/lib/active_record/connection_adapters/abstract/database_statements.rb +171 -0
- data/lib/active_record/connection_adapters/abstract/query_cache.rb +87 -0
- data/lib/active_record/connection_adapters/abstract/quoting.rb +69 -0
- data/lib/active_record/connection_adapters/abstract/schema_definitions.rb +472 -0
- data/lib/active_record/connection_adapters/abstract/schema_statements.rb +306 -0
- data/lib/active_record/connection_adapters/abstract_adapter.rb +125 -279
- data/lib/active_record/connection_adapters/mysql_adapter.rb +442 -77
- data/lib/active_record/connection_adapters/postgresql_adapter.rb +805 -135
- data/lib/active_record/connection_adapters/sqlite3_adapter.rb +34 -0
- data/lib/active_record/connection_adapters/sqlite_adapter.rb +353 -69
- data/lib/active_record/fixtures.rb +946 -100
- data/lib/active_record/locking/optimistic.rb +144 -0
- data/lib/active_record/locking/pessimistic.rb +77 -0
- data/lib/active_record/migration.rb +417 -0
- data/lib/active_record/observer.rb +142 -32
- data/lib/active_record/query_cache.rb +23 -0
- data/lib/active_record/reflection.rb +163 -70
- data/lib/active_record/schema.rb +58 -0
- data/lib/active_record/schema_dumper.rb +171 -0
- data/lib/active_record/serialization.rb +98 -0
- data/lib/active_record/serializers/json_serializer.rb +71 -0
- data/lib/active_record/serializers/xml_serializer.rb +315 -0
- data/lib/active_record/timestamp.rb +41 -0
- data/lib/active_record/transactions.rb +87 -57
- data/lib/active_record/validations.rb +909 -122
- data/lib/active_record/vendor/db2.rb +362 -0
- data/lib/active_record/vendor/mysql.rb +126 -29
- data/lib/active_record/version.rb +9 -0
- data/lib/active_record.rb +35 -7
- data/lib/activerecord.rb +1 -0
- data/test/aaa_create_tables_test.rb +72 -0
- data/test/abstract_unit.rb +73 -5
- data/test/active_schema_test_mysql.rb +43 -0
- data/test/adapter_test.rb +105 -0
- data/test/adapter_test_sqlserver.rb +95 -0
- data/test/aggregations_test.rb +110 -16
- data/test/all.sh +2 -2
- data/test/ar_schema_test.rb +33 -0
- data/test/association_inheritance_reload.rb +14 -0
- data/test/associations/ar_joins_test.rb +0 -0
- data/test/associations/callbacks_test.rb +147 -0
- data/test/associations/cascaded_eager_loading_test.rb +110 -0
- data/test/associations/eager_singularization_test.rb +145 -0
- data/test/associations/eager_test.rb +442 -0
- data/test/associations/extension_test.rb +47 -0
- data/test/associations/inner_join_association_test.rb +88 -0
- data/test/associations/join_model_test.rb +553 -0
- data/test/associations_test.rb +1930 -267
- data/test/attribute_methods_test.rb +146 -0
- data/test/base_test.rb +1316 -84
- data/test/binary_test.rb +32 -0
- data/test/calculations_test.rb +251 -0
- data/test/callbacks_test.rb +400 -0
- data/test/class_inheritable_attributes_test.rb +3 -4
- data/test/column_alias_test.rb +17 -0
- data/test/connection_test_firebird.rb +8 -0
- data/test/connection_test_mysql.rb +30 -0
- data/test/connections/native_db2/connection.rb +25 -0
- data/test/connections/native_firebird/connection.rb +26 -0
- data/test/connections/native_frontbase/connection.rb +27 -0
- data/test/connections/native_mysql/connection.rb +21 -18
- data/test/connections/native_openbase/connection.rb +21 -0
- data/test/connections/native_oracle/connection.rb +27 -0
- data/test/connections/native_postgresql/connection.rb +17 -18
- data/test/connections/native_sqlite/connection.rb +17 -16
- data/test/connections/native_sqlite3/connection.rb +25 -0
- data/test/connections/native_sqlite3/in_memory_connection.rb +18 -0
- data/test/connections/native_sybase/connection.rb +23 -0
- data/test/copy_table_test_sqlite.rb +69 -0
- data/test/datatype_test_postgresql.rb +203 -0
- data/test/date_time_test.rb +37 -0
- data/test/default_test_firebird.rb +16 -0
- data/test/defaults_test.rb +67 -0
- data/test/deprecated_finder_test.rb +30 -0
- data/test/finder_test.rb +607 -32
- data/test/fixtures/accounts.yml +28 -0
- data/test/fixtures/all/developers.yml +0 -0
- data/test/fixtures/all/people.csv +0 -0
- data/test/fixtures/all/tasks.yml +0 -0
- data/test/fixtures/author.rb +107 -0
- data/test/fixtures/author_favorites.yml +4 -0
- data/test/fixtures/authors.yml +7 -0
- data/test/fixtures/bad_fixtures/attr_with_numeric_first_char +1 -0
- data/test/fixtures/bad_fixtures/attr_with_spaces +1 -0
- data/test/fixtures/bad_fixtures/blank_line +3 -0
- data/test/fixtures/bad_fixtures/duplicate_attributes +3 -0
- data/test/fixtures/bad_fixtures/missing_value +1 -0
- data/test/fixtures/binaries.yml +132 -0
- data/test/fixtures/binary.rb +2 -0
- data/test/fixtures/book.rb +4 -0
- data/test/fixtures/books.yml +7 -0
- data/test/fixtures/categories/special_categories.yml +9 -0
- data/test/fixtures/categories/subsubdir/arbitrary_filename.yml +4 -0
- data/test/fixtures/categories.yml +14 -0
- data/test/fixtures/categories_ordered.yml +7 -0
- data/test/fixtures/categories_posts.yml +23 -0
- data/test/fixtures/categorization.rb +5 -0
- data/test/fixtures/categorizations.yml +17 -0
- data/test/fixtures/category.rb +26 -0
- data/test/fixtures/citation.rb +6 -0
- data/test/fixtures/comment.rb +23 -0
- data/test/fixtures/comments.yml +59 -0
- data/test/fixtures/companies.yml +55 -0
- data/test/fixtures/company.rb +81 -4
- data/test/fixtures/company_in_module.rb +32 -6
- data/test/fixtures/computer.rb +4 -0
- data/test/fixtures/computers.yml +4 -0
- data/test/fixtures/contact.rb +16 -0
- data/test/fixtures/courses.yml +7 -0
- data/test/fixtures/customer.rb +28 -3
- data/test/fixtures/customers.yml +17 -0
- data/test/fixtures/db_definitions/db2.drop.sql +33 -0
- data/test/fixtures/db_definitions/db2.sql +235 -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/firebird.drop.sql +65 -0
- data/test/fixtures/db_definitions/firebird.sql +310 -0
- data/test/fixtures/db_definitions/firebird2.drop.sql +2 -0
- data/test/fixtures/db_definitions/firebird2.sql +6 -0
- data/test/fixtures/db_definitions/frontbase.drop.sql +33 -0
- data/test/fixtures/db_definitions/frontbase.sql +273 -0
- data/test/fixtures/db_definitions/frontbase2.drop.sql +1 -0
- data/test/fixtures/db_definitions/frontbase2.sql +4 -0
- data/test/fixtures/db_definitions/openbase.drop.sql +2 -0
- data/test/fixtures/db_definitions/openbase.sql +318 -0
- data/test/fixtures/db_definitions/openbase2.drop.sql +2 -0
- data/test/fixtures/db_definitions/openbase2.sql +7 -0
- data/test/fixtures/db_definitions/oracle.drop.sql +67 -0
- data/test/fixtures/db_definitions/oracle.sql +330 -0
- data/test/fixtures/db_definitions/oracle2.drop.sql +2 -0
- data/test/fixtures/db_definitions/oracle2.sql +6 -0
- data/test/fixtures/db_definitions/postgresql.drop.sql +44 -0
- data/test/fixtures/db_definitions/postgresql.sql +217 -38
- data/test/fixtures/db_definitions/postgresql2.drop.sql +2 -0
- data/test/fixtures/db_definitions/postgresql2.sql +2 -2
- data/test/fixtures/db_definitions/schema.rb +354 -0
- data/test/fixtures/db_definitions/schema2.rb +11 -0
- data/test/fixtures/db_definitions/sqlite.drop.sql +33 -0
- data/test/fixtures/db_definitions/sqlite.sql +139 -5
- data/test/fixtures/db_definitions/sqlite2.drop.sql +2 -0
- data/test/fixtures/db_definitions/sqlite2.sql +1 -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/developer.rb +70 -6
- data/test/fixtures/developers.yml +21 -0
- data/test/fixtures/developers_projects/david_action_controller +2 -1
- data/test/fixtures/developers_projects/david_active_record +2 -1
- data/test/fixtures/developers_projects.yml +17 -0
- data/test/fixtures/edge.rb +5 -0
- data/test/fixtures/edges.yml +6 -0
- data/test/fixtures/entrants.yml +14 -0
- data/test/fixtures/example.log +1 -0
- data/test/fixtures/fk_test_has_fk.yml +3 -0
- data/test/fixtures/fk_test_has_pk.yml +2 -0
- data/test/fixtures/flowers.jpg +0 -0
- data/test/fixtures/funny_jokes.yml +10 -0
- data/test/fixtures/item.rb +7 -0
- data/test/fixtures/items.yml +4 -0
- data/test/fixtures/joke.rb +3 -0
- data/test/fixtures/keyboard.rb +3 -0
- data/test/fixtures/legacy_thing.rb +3 -0
- data/test/fixtures/legacy_things.yml +3 -0
- data/test/fixtures/matey.rb +4 -0
- data/test/fixtures/mateys.yml +4 -0
- data/test/fixtures/migrations/1_people_have_last_names.rb +9 -0
- data/test/fixtures/migrations/2_we_need_reminders.rb +12 -0
- data/test/fixtures/migrations/3_innocent_jointable.rb +12 -0
- data/test/fixtures/migrations_with_decimal/1_give_me_big_numbers.rb +15 -0
- data/test/fixtures/migrations_with_duplicate/1_people_have_last_names.rb +9 -0
- data/test/fixtures/migrations_with_duplicate/2_we_need_reminders.rb +12 -0
- data/test/fixtures/migrations_with_duplicate/3_foo.rb +7 -0
- data/test/fixtures/migrations_with_duplicate/3_innocent_jointable.rb +12 -0
- data/test/fixtures/migrations_with_missing_versions/1000_people_have_middle_names.rb +9 -0
- data/test/fixtures/migrations_with_missing_versions/1_people_have_last_names.rb +9 -0
- data/test/fixtures/migrations_with_missing_versions/3_we_need_reminders.rb +12 -0
- data/test/fixtures/migrations_with_missing_versions/4_innocent_jointable.rb +12 -0
- data/test/fixtures/minimalistic.rb +2 -0
- data/test/fixtures/minimalistics.yml +2 -0
- data/test/fixtures/mixed_case_monkey.rb +3 -0
- data/test/fixtures/mixed_case_monkeys.yml +6 -0
- data/test/fixtures/mixins.yml +29 -0
- data/test/fixtures/movies.yml +7 -0
- data/test/fixtures/naked/csv/accounts.csv +1 -0
- data/test/fixtures/naked/yml/accounts.yml +1 -0
- data/test/fixtures/naked/yml/companies.yml +1 -0
- data/test/fixtures/naked/yml/courses.yml +1 -0
- data/test/fixtures/order.rb +4 -0
- data/test/fixtures/parrot.rb +13 -0
- data/test/fixtures/parrots.yml +27 -0
- data/test/fixtures/parrots_pirates.yml +7 -0
- data/test/fixtures/people.yml +3 -0
- data/test/fixtures/person.rb +4 -0
- data/test/fixtures/pirate.rb +5 -0
- data/test/fixtures/pirates.yml +9 -0
- data/test/fixtures/post.rb +59 -0
- data/test/fixtures/posts.yml +48 -0
- data/test/fixtures/project.rb +27 -2
- data/test/fixtures/projects.yml +7 -0
- data/test/fixtures/reader.rb +4 -0
- data/test/fixtures/readers.yml +4 -0
- data/test/fixtures/reply.rb +18 -2
- data/test/fixtures/reserved_words/distinct.yml +5 -0
- data/test/fixtures/reserved_words/distincts_selects.yml +11 -0
- data/test/fixtures/reserved_words/group.yml +14 -0
- data/test/fixtures/reserved_words/select.yml +8 -0
- data/test/fixtures/reserved_words/values.yml +7 -0
- data/test/fixtures/ship.rb +3 -0
- data/test/fixtures/ships.yml +5 -0
- data/test/fixtures/subject.rb +4 -0
- data/test/fixtures/subscriber.rb +4 -3
- data/test/fixtures/tag.rb +7 -0
- data/test/fixtures/tagging.rb +10 -0
- data/test/fixtures/taggings.yml +25 -0
- data/test/fixtures/tags.yml +7 -0
- data/test/fixtures/task.rb +3 -0
- data/test/fixtures/tasks.yml +7 -0
- data/test/fixtures/topic.rb +20 -3
- data/test/fixtures/topics.yml +22 -0
- data/test/fixtures/treasure.rb +4 -0
- data/test/fixtures/treasures.yml +10 -0
- data/test/fixtures/vertex.rb +9 -0
- data/test/fixtures/vertices.yml +4 -0
- data/test/fixtures_test.rb +574 -8
- data/test/inheritance_test.rb +113 -27
- data/test/json_serialization_test.rb +180 -0
- data/test/lifecycle_test.rb +56 -29
- data/test/locking_test.rb +273 -0
- data/test/method_scoping_test.rb +416 -0
- data/test/migration_test.rb +933 -0
- data/test/migration_test_firebird.rb +124 -0
- data/test/mixin_test.rb +95 -0
- data/test/modules_test.rb +23 -10
- data/test/multiple_db_test.rb +17 -3
- data/test/pk_test.rb +59 -15
- data/test/query_cache_test.rb +104 -0
- data/test/readonly_test.rb +107 -0
- data/test/reflection_test.rb +124 -27
- data/test/reserved_word_test_mysql.rb +177 -0
- data/test/schema_authorization_test_postgresql.rb +75 -0
- data/test/schema_dumper_test.rb +131 -0
- data/test/schema_test_postgresql.rb +64 -0
- data/test/serialization_test.rb +47 -0
- data/test/synonym_test_oracle.rb +17 -0
- data/test/table_name_test_sqlserver.rb +23 -0
- data/test/threaded_connections_test.rb +48 -0
- data/test/transactions_test.rb +227 -29
- data/test/unconnected_test.rb +14 -6
- data/test/validations_test.rb +1293 -32
- data/test/xml_serialization_test.rb +202 -0
- metadata +347 -143
- data/dev-utils/eval_debugger.rb +0 -9
- data/examples/associations.rb +0 -87
- data/examples/shared_setup.rb +0 -15
- data/examples/validation.rb +0 -88
- data/lib/active_record/deprecated_associations.rb +0 -70
- data/lib/active_record/support/class_attribute_accessors.rb +0 -43
- data/lib/active_record/support/class_inheritable_attributes.rb +0 -37
- data/lib/active_record/support/clean_logger.rb +0 -10
- data/lib/active_record/support/inflector.rb +0 -70
- data/lib/active_record/vendor/simple.rb +0 -702
- data/lib/active_record/wrappers/yaml_wrapper.rb +0 -15
- data/lib/active_record/wrappings.rb +0 -59
- data/rakefile +0 -122
- data/test/deprecated_associations_test.rb +0 -336
- data/test/fixtures/accounts/signals37 +0 -3
- data/test/fixtures/accounts/unknown +0 -2
- data/test/fixtures/companies/first_client +0 -6
- data/test/fixtures/companies/first_firm +0 -4
- data/test/fixtures/companies/second_client +0 -6
- data/test/fixtures/courses/java +0 -2
- data/test/fixtures/courses/ruby +0 -2
- data/test/fixtures/customers/david +0 -6
- data/test/fixtures/db_definitions/mysql.sql +0 -96
- data/test/fixtures/db_definitions/mysql2.sql +0 -4
- data/test/fixtures/developers/david +0 -2
- data/test/fixtures/developers/jamis +0 -2
- data/test/fixtures/entrants/first +0 -3
- data/test/fixtures/entrants/second +0 -3
- data/test/fixtures/entrants/third +0 -3
- data/test/fixtures/fixture_database.sqlite +0 -0
- data/test/fixtures/fixture_database_2.sqlite +0 -0
- data/test/fixtures/movies/first +0 -2
- data/test/fixtures/movies/second +0 -2
- data/test/fixtures/projects/action_controller +0 -2
- data/test/fixtures/projects/active_record +0 -2
- data/test/fixtures/topics/first +0 -9
- data/test/fixtures/topics/second +0 -8
- data/test/inflector_test.rb +0 -104
- data/test/thread_safety_test.rb +0 -33
@@ -0,0 +1,310 @@
|
|
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;
|
305
|
+
|
306
|
+
CREATE TABLE minimalistics (
|
307
|
+
id BIGINT NOT NULL
|
308
|
+
);
|
309
|
+
CREATE GENERATOR minimalistics_seq;
|
310
|
+
SET GENERATOR minimalistics_seq TO 10000;
|
@@ -0,0 +1,33 @@
|
|
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;
|
33
|
+
DROP TABLE minimalistics CASCADE;
|
@@ -0,0 +1,273 @@
|
|
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");
|
269
|
+
|
270
|
+
CREATE TABLE minimalistics (
|
271
|
+
"id" integer NOT NULL
|
272
|
+
);
|
273
|
+
SET UNIQUE FOR minimalistics("id");
|
@@ -0,0 +1 @@
|
|
1
|
+
DROP TABLE courses CASCADE;
|