activerecord_authorails 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3043 -0
- data/README +360 -0
- data/RUNNING_UNIT_TESTS +64 -0
- data/Rakefile +226 -0
- data/examples/associations.png +0 -0
- data/examples/associations.rb +87 -0
- data/examples/shared_setup.rb +15 -0
- data/examples/validation.rb +85 -0
- data/install.rb +30 -0
- data/lib/active_record.rb +85 -0
- data/lib/active_record/acts/list.rb +244 -0
- data/lib/active_record/acts/nested_set.rb +211 -0
- data/lib/active_record/acts/tree.rb +89 -0
- data/lib/active_record/aggregations.rb +191 -0
- data/lib/active_record/associations.rb +1637 -0
- data/lib/active_record/associations/association_collection.rb +190 -0
- data/lib/active_record/associations/association_proxy.rb +158 -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 +169 -0
- data/lib/active_record/associations/has_many_association.rb +210 -0
- data/lib/active_record/associations/has_many_through_association.rb +247 -0
- data/lib/active_record/associations/has_one_association.rb +80 -0
- data/lib/active_record/attribute_methods.rb +75 -0
- data/lib/active_record/base.rb +2164 -0
- data/lib/active_record/calculations.rb +270 -0
- data/lib/active_record/callbacks.rb +367 -0
- data/lib/active_record/connection_adapters/abstract/connection_specification.rb +279 -0
- data/lib/active_record/connection_adapters/abstract/database_statements.rb +130 -0
- data/lib/active_record/connection_adapters/abstract/quoting.rb +58 -0
- data/lib/active_record/connection_adapters/abstract/schema_definitions.rb +343 -0
- data/lib/active_record/connection_adapters/abstract/schema_statements.rb +310 -0
- data/lib/active_record/connection_adapters/abstract_adapter.rb +161 -0
- data/lib/active_record/connection_adapters/db2_adapter.rb +228 -0
- data/lib/active_record/connection_adapters/firebird_adapter.rb +728 -0
- data/lib/active_record/connection_adapters/frontbase_adapter.rb +861 -0
- data/lib/active_record/connection_adapters/mysql_adapter.rb +414 -0
- data/lib/active_record/connection_adapters/openbase_adapter.rb +350 -0
- data/lib/active_record/connection_adapters/oracle_adapter.rb +689 -0
- data/lib/active_record/connection_adapters/postgresql_adapter.rb +584 -0
- data/lib/active_record/connection_adapters/sqlite_adapter.rb +407 -0
- data/lib/active_record/connection_adapters/sqlserver_adapter.rb +591 -0
- data/lib/active_record/connection_adapters/sybase_adapter.rb +662 -0
- data/lib/active_record/deprecated_associations.rb +104 -0
- data/lib/active_record/deprecated_finders.rb +44 -0
- data/lib/active_record/fixtures.rb +628 -0
- data/lib/active_record/locking/optimistic.rb +106 -0
- data/lib/active_record/locking/pessimistic.rb +77 -0
- data/lib/active_record/migration.rb +394 -0
- data/lib/active_record/observer.rb +178 -0
- data/lib/active_record/query_cache.rb +64 -0
- data/lib/active_record/reflection.rb +222 -0
- data/lib/active_record/schema.rb +58 -0
- data/lib/active_record/schema_dumper.rb +149 -0
- data/lib/active_record/timestamp.rb +51 -0
- data/lib/active_record/transactions.rb +136 -0
- data/lib/active_record/validations.rb +843 -0
- data/lib/active_record/vendor/db2.rb +362 -0
- data/lib/active_record/vendor/mysql.rb +1214 -0
- data/lib/active_record/vendor/simple.rb +693 -0
- data/lib/active_record/version.rb +9 -0
- data/lib/active_record/wrappers/yaml_wrapper.rb +15 -0
- data/lib/active_record/wrappings.rb +58 -0
- data/lib/active_record/xml_serialization.rb +308 -0
- data/test/aaa_create_tables_test.rb +59 -0
- data/test/abstract_unit.rb +77 -0
- data/test/active_schema_test_mysql.rb +31 -0
- data/test/adapter_test.rb +87 -0
- data/test/adapter_test_sqlserver.rb +81 -0
- data/test/aggregations_test.rb +95 -0
- data/test/all.sh +8 -0
- data/test/ar_schema_test.rb +33 -0
- data/test/association_inheritance_reload.rb +14 -0
- data/test/associations/callbacks_test.rb +126 -0
- data/test/associations/cascaded_eager_loading_test.rb +138 -0
- data/test/associations/eager_test.rb +393 -0
- data/test/associations/extension_test.rb +42 -0
- data/test/associations/join_model_test.rb +497 -0
- data/test/associations_test.rb +1809 -0
- data/test/attribute_methods_test.rb +49 -0
- data/test/base_test.rb +1586 -0
- data/test/binary_test.rb +37 -0
- data/test/calculations_test.rb +219 -0
- data/test/callbacks_test.rb +377 -0
- data/test/class_inheritable_attributes_test.rb +32 -0
- data/test/column_alias_test.rb +17 -0
- data/test/connection_test_firebird.rb +8 -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 +24 -0
- 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 +23 -0
- data/test/connections/native_sqlite/connection.rb +34 -0
- data/test/connections/native_sqlite3/connection.rb +34 -0
- data/test/connections/native_sqlite3/in_memory_connection.rb +18 -0
- data/test/connections/native_sqlserver/connection.rb +23 -0
- data/test/connections/native_sqlserver_odbc/connection.rb +25 -0
- data/test/connections/native_sybase/connection.rb +23 -0
- data/test/copy_table_sqlite.rb +64 -0
- data/test/datatype_test_postgresql.rb +52 -0
- data/test/default_test_firebird.rb +16 -0
- data/test/defaults_test.rb +60 -0
- data/test/deprecated_associations_test.rb +396 -0
- data/test/deprecated_finder_test.rb +151 -0
- data/test/empty_date_time_test.rb +25 -0
- data/test/finder_test.rb +504 -0
- data/test/fixtures/accounts.yml +28 -0
- data/test/fixtures/author.rb +99 -0
- data/test/fixtures/author_favorites.yml +4 -0
- data/test/fixtures/authors.yml +7 -0
- data/test/fixtures/auto_id.rb +4 -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/binary.rb +2 -0
- data/test/fixtures/categories.yml +14 -0
- data/test/fixtures/categories/special_categories.yml +9 -0
- data/test/fixtures/categories/subsubdir/arbitrary_filename.yml +4 -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 +20 -0
- data/test/fixtures/column_name.rb +3 -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 +107 -0
- data/test/fixtures/company_in_module.rb +59 -0
- data/test/fixtures/computer.rb +3 -0
- data/test/fixtures/computers.yml +4 -0
- data/test/fixtures/course.rb +3 -0
- data/test/fixtures/courses.yml +7 -0
- data/test/fixtures/customer.rb +55 -0
- data/test/fixtures/customers.yml +17 -0
- data/test/fixtures/db_definitions/db2.drop.sql +32 -0
- data/test/fixtures/db_definitions/db2.sql +231 -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 +63 -0
- data/test/fixtures/db_definitions/firebird.sql +304 -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 +32 -0
- data/test/fixtures/db_definitions/frontbase.sql +268 -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/mysql.drop.sql +32 -0
- data/test/fixtures/db_definitions/mysql.sql +234 -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/openbase.drop.sql +2 -0
- data/test/fixtures/db_definitions/openbase.sql +302 -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 +65 -0
- data/test/fixtures/db_definitions/oracle.sql +325 -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 +37 -0
- data/test/fixtures/db_definitions/postgresql.sql +263 -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/schema.rb +60 -0
- data/test/fixtures/db_definitions/sqlite.drop.sql +32 -0
- data/test/fixtures/db_definitions/sqlite.sql +215 -0
- data/test/fixtures/db_definitions/sqlite2.drop.sql +2 -0
- data/test/fixtures/db_definitions/sqlite2.sql +5 -0
- data/test/fixtures/db_definitions/sqlserver.drop.sql +34 -0
- data/test/fixtures/db_definitions/sqlserver.sql +243 -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 +34 -0
- data/test/fixtures/db_definitions/sybase.sql +218 -0
- data/test/fixtures/db_definitions/sybase2.drop.sql +4 -0
- data/test/fixtures/db_definitions/sybase2.sql +5 -0
- data/test/fixtures/default.rb +2 -0
- data/test/fixtures/developer.rb +52 -0
- data/test/fixtures/developers.yml +21 -0
- data/test/fixtures/developers_projects.yml +17 -0
- data/test/fixtures/developers_projects/david_action_controller +3 -0
- data/test/fixtures/developers_projects/david_active_record +3 -0
- data/test/fixtures/developers_projects/jamis_active_record +2 -0
- data/test/fixtures/edge.rb +5 -0
- data/test/fixtures/edges.yml +6 -0
- data/test/fixtures/entrant.rb +3 -0
- data/test/fixtures/entrants.yml +14 -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/joke.rb +6 -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/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/mixed_case_monkey.rb +3 -0
- data/test/fixtures/mixed_case_monkeys.yml +6 -0
- data/test/fixtures/mixin.rb +63 -0
- data/test/fixtures/mixins.yml +127 -0
- data/test/fixtures/movie.rb +5 -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/people.yml +3 -0
- data/test/fixtures/person.rb +4 -0
- data/test/fixtures/post.rb +58 -0
- data/test/fixtures/posts.yml +48 -0
- data/test/fixtures/project.rb +27 -0
- 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 +37 -0
- data/test/fixtures/subject.rb +4 -0
- data/test/fixtures/subscriber.rb +6 -0
- data/test/fixtures/subscribers/first +2 -0
- data/test/fixtures/subscribers/second +2 -0
- data/test/fixtures/tag.rb +7 -0
- data/test/fixtures/tagging.rb +6 -0
- data/test/fixtures/taggings.yml +18 -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 +25 -0
- data/test/fixtures/topics.yml +22 -0
- data/test/fixtures/vertex.rb +9 -0
- data/test/fixtures/vertices.yml +4 -0
- data/test/fixtures_test.rb +401 -0
- data/test/inheritance_test.rb +205 -0
- data/test/lifecycle_test.rb +137 -0
- data/test/locking_test.rb +190 -0
- data/test/method_scoping_test.rb +416 -0
- data/test/migration_test.rb +768 -0
- data/test/migration_test_firebird.rb +124 -0
- data/test/mixin_nested_set_test.rb +196 -0
- data/test/mixin_test.rb +550 -0
- data/test/modules_test.rb +34 -0
- data/test/multiple_db_test.rb +60 -0
- data/test/pk_test.rb +104 -0
- data/test/readonly_test.rb +107 -0
- data/test/reflection_test.rb +159 -0
- data/test/schema_authorization_test_postgresql.rb +75 -0
- data/test/schema_dumper_test.rb +96 -0
- data/test/schema_test_postgresql.rb +64 -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 +230 -0
- data/test/unconnected_test.rb +32 -0
- data/test/validations_test.rb +1097 -0
- data/test/xml_serialization_test.rb +125 -0
- metadata +365 -0
@@ -0,0 +1,65 @@
|
|
1
|
+
drop table accounts;
|
2
|
+
drop table funny_jokes;
|
3
|
+
drop table companies;
|
4
|
+
drop table topics;
|
5
|
+
drop synonym subjects;
|
6
|
+
drop table developers_projects;
|
7
|
+
drop table computers;
|
8
|
+
drop table developers;
|
9
|
+
drop table projects;
|
10
|
+
drop table customers;
|
11
|
+
drop table orders;
|
12
|
+
drop table movies;
|
13
|
+
drop table subscribers;
|
14
|
+
drop table booleantests;
|
15
|
+
drop table auto_id_tests;
|
16
|
+
drop table entrants;
|
17
|
+
drop table colnametests;
|
18
|
+
drop table mixins;
|
19
|
+
drop table people;
|
20
|
+
drop table readers;
|
21
|
+
drop table binaries;
|
22
|
+
drop table comments;
|
23
|
+
drop table authors;
|
24
|
+
drop table tasks;
|
25
|
+
drop table categories_posts;
|
26
|
+
drop table categories;
|
27
|
+
drop table posts;
|
28
|
+
drop table fk_test_has_pk;
|
29
|
+
drop table fk_test_has_fk;
|
30
|
+
drop table keyboards;
|
31
|
+
drop table legacy_things;
|
32
|
+
drop table numeric_data;
|
33
|
+
drop table mixed_case_monkeys;
|
34
|
+
|
35
|
+
drop sequence accounts_seq;
|
36
|
+
drop sequence funny_jokes_seq;
|
37
|
+
drop sequence companies_nonstd_seq;
|
38
|
+
drop sequence topics_seq;
|
39
|
+
drop sequence developers_seq;
|
40
|
+
drop sequence projects_seq;
|
41
|
+
drop sequence developers_projects_seq;
|
42
|
+
drop sequence customers_seq;
|
43
|
+
drop sequence orders_seq;
|
44
|
+
drop sequence movies_seq;
|
45
|
+
drop sequence subscribers_seq;
|
46
|
+
drop sequence booleantests_seq;
|
47
|
+
drop sequence auto_id_tests_seq;
|
48
|
+
drop sequence entrants_seq;
|
49
|
+
drop sequence colnametests_seq;
|
50
|
+
drop sequence mixins_seq;
|
51
|
+
drop sequence people_seq;
|
52
|
+
drop sequence binaries_seq;
|
53
|
+
drop sequence posts_seq;
|
54
|
+
drop sequence comments_seq;
|
55
|
+
drop sequence authors_seq;
|
56
|
+
drop sequence tasks_seq;
|
57
|
+
drop sequence computers_seq;
|
58
|
+
drop sequence categories_seq;
|
59
|
+
drop sequence categories_posts_seq;
|
60
|
+
drop sequence fk_test_has_pk_seq;
|
61
|
+
drop sequence fk_test_has_fk_seq;
|
62
|
+
drop sequence keyboards_seq;
|
63
|
+
drop sequence legacy_things_seq;
|
64
|
+
drop sequence numeric_data_seq;
|
65
|
+
drop sequence mixed_case_monkeys_seq;
|
@@ -0,0 +1,325 @@
|
|
1
|
+
create table companies (
|
2
|
+
id integer not null,
|
3
|
+
type varchar(50) default null,
|
4
|
+
ruby_type varchar(50) default null,
|
5
|
+
firm_id integer default null references companies initially deferred disable,
|
6
|
+
name varchar(50) default null,
|
7
|
+
client_of integer default null references companies initially deferred disable,
|
8
|
+
companies_count integer default 0,
|
9
|
+
rating integer default 1,
|
10
|
+
primary key (id)
|
11
|
+
);
|
12
|
+
|
13
|
+
-- non-standard sequence name used to test set_sequence_name
|
14
|
+
--
|
15
|
+
create sequence companies_nonstd_seq minvalue 10000;
|
16
|
+
|
17
|
+
create table funny_jokes (
|
18
|
+
id integer not null,
|
19
|
+
name varchar(50) default null,
|
20
|
+
primary key (id)
|
21
|
+
);
|
22
|
+
create sequence funny_jokes_seq minvalue 10000;
|
23
|
+
|
24
|
+
create table accounts (
|
25
|
+
id integer not null,
|
26
|
+
firm_id integer default null references companies initially deferred disable,
|
27
|
+
credit_limit integer default null
|
28
|
+
);
|
29
|
+
create sequence accounts_seq minvalue 10000;
|
30
|
+
|
31
|
+
create table topics (
|
32
|
+
id integer not null,
|
33
|
+
title varchar(255) default null,
|
34
|
+
author_name varchar(255) default null,
|
35
|
+
author_email_address varchar(255) default null,
|
36
|
+
written_on timestamp default null,
|
37
|
+
bonus_time timestamp default null,
|
38
|
+
last_read timestamp default null,
|
39
|
+
content varchar(4000),
|
40
|
+
approved number(1) default 1,
|
41
|
+
replies_count integer default 0,
|
42
|
+
parent_id integer references topics initially deferred disable,
|
43
|
+
type varchar(50) default null,
|
44
|
+
primary key (id)
|
45
|
+
);
|
46
|
+
-- try again for 8i
|
47
|
+
create table topics (
|
48
|
+
id integer not null,
|
49
|
+
title varchar(255) default null,
|
50
|
+
author_name varchar(255) default null,
|
51
|
+
author_email_address varchar(255) default null,
|
52
|
+
written_on date default null,
|
53
|
+
bonus_time date default null,
|
54
|
+
last_read date default null,
|
55
|
+
content varchar(4000),
|
56
|
+
approved number(1) default 1,
|
57
|
+
replies_count integer default 0,
|
58
|
+
parent_id integer references topics initially deferred disable,
|
59
|
+
type varchar(50) default null,
|
60
|
+
primary key (id)
|
61
|
+
);
|
62
|
+
create sequence topics_seq minvalue 10000;
|
63
|
+
|
64
|
+
create synonym subjects for topics;
|
65
|
+
|
66
|
+
create table developers (
|
67
|
+
id integer not null,
|
68
|
+
name varchar(100) default null,
|
69
|
+
salary integer default 70000,
|
70
|
+
created_at timestamp default null,
|
71
|
+
updated_at timestamp default null,
|
72
|
+
primary key (id)
|
73
|
+
);
|
74
|
+
create sequence developers_seq minvalue 10000;
|
75
|
+
|
76
|
+
create table projects (
|
77
|
+
id integer not null,
|
78
|
+
name varchar(100) default null,
|
79
|
+
type varchar(255) default null,
|
80
|
+
primary key (id)
|
81
|
+
);
|
82
|
+
create sequence projects_seq minvalue 10000;
|
83
|
+
|
84
|
+
create table developers_projects (
|
85
|
+
developer_id integer not null references developers initially deferred disable,
|
86
|
+
project_id integer not null references projects initially deferred disable,
|
87
|
+
joined_on timestamp default null,
|
88
|
+
access_level integer default 1
|
89
|
+
);
|
90
|
+
-- Try again for 8i
|
91
|
+
create table developers_projects (
|
92
|
+
developer_id integer not null references developers initially deferred disable,
|
93
|
+
project_id integer not null references projects initially deferred disable,
|
94
|
+
joined_on date default null
|
95
|
+
);
|
96
|
+
create sequence developers_projects_seq minvalue 10000;
|
97
|
+
|
98
|
+
create table orders (
|
99
|
+
id integer not null,
|
100
|
+
name varchar(100) default null,
|
101
|
+
billing_customer_id integer default null,
|
102
|
+
shipping_customer_id integer default null,
|
103
|
+
primary key (id)
|
104
|
+
);
|
105
|
+
create sequence orders_seq minvalue 10000;
|
106
|
+
|
107
|
+
create table customers (
|
108
|
+
id integer not null,
|
109
|
+
name varchar(100) default null,
|
110
|
+
balance integer default 0,
|
111
|
+
address_street varchar(100) default null,
|
112
|
+
address_city varchar(100) default null,
|
113
|
+
address_country varchar(100) default null,
|
114
|
+
gps_location varchar(100) default null,
|
115
|
+
primary key (id)
|
116
|
+
);
|
117
|
+
create sequence customers_seq minvalue 10000;
|
118
|
+
|
119
|
+
create table movies (
|
120
|
+
movieid integer not null,
|
121
|
+
name varchar(100) default null,
|
122
|
+
primary key (movieid)
|
123
|
+
);
|
124
|
+
create sequence movies_seq minvalue 10000;
|
125
|
+
|
126
|
+
create table subscribers (
|
127
|
+
nick varchar(100) not null,
|
128
|
+
name varchar(100) default null,
|
129
|
+
primary key (nick)
|
130
|
+
);
|
131
|
+
create sequence subscribers_seq minvalue 10000;
|
132
|
+
|
133
|
+
create table booleantests (
|
134
|
+
id integer not null,
|
135
|
+
value integer default null,
|
136
|
+
primary key (id)
|
137
|
+
);
|
138
|
+
create sequence booleantests_seq minvalue 10000;
|
139
|
+
|
140
|
+
CREATE TABLE defaults (
|
141
|
+
id integer not null,
|
142
|
+
modified_date date default sysdate,
|
143
|
+
modified_date_function date default sysdate,
|
144
|
+
fixed_date date default to_date('2004-01-01', 'YYYY-MM-DD'),
|
145
|
+
modified_time date default sysdate,
|
146
|
+
modified_time_function date default sysdate,
|
147
|
+
fixed_time date default TO_DATE('2004-01-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS'),
|
148
|
+
char1 varchar2(1) default 'Y',
|
149
|
+
char2 varchar2(50) default 'a varchar field',
|
150
|
+
char3 clob default 'a text field',
|
151
|
+
positive_integer integer default 1,
|
152
|
+
negative_integer integer default -1,
|
153
|
+
decimal_number number(3,2) default 2.78
|
154
|
+
);
|
155
|
+
create sequence defaults_seq minvalue 10000;
|
156
|
+
|
157
|
+
create table auto_id_tests (
|
158
|
+
auto_id integer not null,
|
159
|
+
value integer default null,
|
160
|
+
primary key (auto_id)
|
161
|
+
);
|
162
|
+
create sequence auto_id_tests_seq minvalue 10000;
|
163
|
+
|
164
|
+
create table entrants (
|
165
|
+
id integer not null primary key,
|
166
|
+
name varchar(255) not null,
|
167
|
+
course_id integer not null
|
168
|
+
);
|
169
|
+
create sequence entrants_seq minvalue 10000;
|
170
|
+
|
171
|
+
create table colnametests (
|
172
|
+
id integer not null,
|
173
|
+
references integer not null,
|
174
|
+
primary key (id)
|
175
|
+
);
|
176
|
+
create sequence colnametests_seq minvalue 10000;
|
177
|
+
|
178
|
+
create table mixins (
|
179
|
+
id integer not null,
|
180
|
+
parent_id integer default null references mixins initially deferred disable,
|
181
|
+
type varchar(40) default null,
|
182
|
+
pos integer default null,
|
183
|
+
lft integer default null,
|
184
|
+
rgt integer default null,
|
185
|
+
root_id integer default null,
|
186
|
+
created_at timestamp default null,
|
187
|
+
updated_at timestamp default null,
|
188
|
+
primary key (id)
|
189
|
+
);
|
190
|
+
-- try again for 8i
|
191
|
+
create table mixins (
|
192
|
+
id integer not null,
|
193
|
+
parent_id integer default null references mixins initially deferred disable,
|
194
|
+
type varchar(40) default null,
|
195
|
+
pos integer default null,
|
196
|
+
lft integer default null,
|
197
|
+
rgt integer default null,
|
198
|
+
root_id integer default null,
|
199
|
+
created_at date default null,
|
200
|
+
updated_at date default null,
|
201
|
+
primary key (id)
|
202
|
+
);
|
203
|
+
create sequence mixins_seq minvalue 10000;
|
204
|
+
|
205
|
+
create table people (
|
206
|
+
id integer not null,
|
207
|
+
first_name varchar(40) null,
|
208
|
+
lock_version integer default 0,
|
209
|
+
primary key (id)
|
210
|
+
);
|
211
|
+
create sequence people_seq minvalue 10000;
|
212
|
+
|
213
|
+
create table readers (
|
214
|
+
id integer not null,
|
215
|
+
post_id integer not null,
|
216
|
+
person_id integer not null,
|
217
|
+
primary key (id)
|
218
|
+
);
|
219
|
+
create sequence readers_seq minvalue 10000;
|
220
|
+
|
221
|
+
create table binaries (
|
222
|
+
id integer not null,
|
223
|
+
data blob null,
|
224
|
+
primary key (id)
|
225
|
+
);
|
226
|
+
create sequence binaries_seq minvalue 10000;
|
227
|
+
|
228
|
+
create table computers (
|
229
|
+
id integer not null primary key,
|
230
|
+
developer integer not null references developers initially deferred disable,
|
231
|
+
"extendedWarranty" integer not null
|
232
|
+
);
|
233
|
+
create sequence computers_seq minvalue 10000;
|
234
|
+
|
235
|
+
create table posts (
|
236
|
+
id integer not null primary key,
|
237
|
+
author_id integer default null,
|
238
|
+
title varchar(255) default null,
|
239
|
+
type varchar(255) default null,
|
240
|
+
body varchar(3000) default null
|
241
|
+
);
|
242
|
+
create sequence posts_seq minvalue 10000;
|
243
|
+
|
244
|
+
create table comments (
|
245
|
+
id integer not null primary key,
|
246
|
+
post_id integer default null,
|
247
|
+
type varchar(255) default null,
|
248
|
+
body varchar(3000) default null
|
249
|
+
);
|
250
|
+
create sequence comments_seq minvalue 10000;
|
251
|
+
|
252
|
+
create table authors (
|
253
|
+
id integer not null primary key,
|
254
|
+
name varchar(255) default null
|
255
|
+
);
|
256
|
+
create sequence authors_seq minvalue 10000;
|
257
|
+
|
258
|
+
create table tasks (
|
259
|
+
id integer not null primary key,
|
260
|
+
starting date default null,
|
261
|
+
ending date default null
|
262
|
+
);
|
263
|
+
create sequence tasks_seq minvalue 10000;
|
264
|
+
|
265
|
+
create table categories (
|
266
|
+
id integer not null primary key,
|
267
|
+
name varchar(255) default null,
|
268
|
+
type varchar(255) default null
|
269
|
+
);
|
270
|
+
create sequence categories_seq minvalue 10000;
|
271
|
+
|
272
|
+
create table categories_posts (
|
273
|
+
category_id integer not null references categories initially deferred disable,
|
274
|
+
post_id integer not null references posts initially deferred disable
|
275
|
+
);
|
276
|
+
create sequence categories_posts_seq minvalue 10000;
|
277
|
+
|
278
|
+
create table fk_test_has_pk (
|
279
|
+
id integer not null primary key
|
280
|
+
);
|
281
|
+
create sequence fk_test_has_pk_seq minvalue 10000;
|
282
|
+
|
283
|
+
create table fk_test_has_fk (
|
284
|
+
id integer not null primary key,
|
285
|
+
fk_id integer not null references fk_test_has_fk initially deferred disable
|
286
|
+
);
|
287
|
+
create sequence fk_test_has_fk_seq minvalue 10000;
|
288
|
+
|
289
|
+
create table keyboards (
|
290
|
+
key_number integer not null,
|
291
|
+
name varchar(50) default null
|
292
|
+
);
|
293
|
+
create sequence keyboards_seq minvalue 10000;
|
294
|
+
|
295
|
+
create table test_oracle_defaults (
|
296
|
+
id integer not null primary key,
|
297
|
+
test_char char(1) default 'X' not null,
|
298
|
+
test_string varchar2(20) default 'hello' not null,
|
299
|
+
test_int integer default 3 not null
|
300
|
+
);
|
301
|
+
create sequence test_oracle_defaults_seq minvalue 10000;
|
302
|
+
|
303
|
+
--This table has an altered lock_version column name.
|
304
|
+
create table legacy_things (
|
305
|
+
id integer not null primary key,
|
306
|
+
tps_report_number integer default null,
|
307
|
+
version integer default 0
|
308
|
+
);
|
309
|
+
create sequence legacy_things_seq minvalue 10000;
|
310
|
+
|
311
|
+
CREATE TABLE numeric_data (
|
312
|
+
id integer NOT NULL PRIMARY KEY,
|
313
|
+
bank_balance decimal(10,2),
|
314
|
+
big_bank_balance decimal(15,2),
|
315
|
+
world_population decimal(10),
|
316
|
+
my_house_population decimal(2),
|
317
|
+
decimal_number_with_default decimal(3,2) DEFAULT 2.78
|
318
|
+
);
|
319
|
+
create sequence numeric_data_seq minvalue 10000;
|
320
|
+
|
321
|
+
CREATE TABLE mixed_case_monkeys (
|
322
|
+
"monkeyID" INTEGER NOT NULL PRIMARY KEY,
|
323
|
+
"fleaCount" INTEGER
|
324
|
+
);
|
325
|
+
create sequence mixed_case_monkeys_seq minvalue 10000;
|
@@ -0,0 +1,37 @@
|
|
1
|
+
DROP TABLE accounts;
|
2
|
+
DROP SEQUENCE accounts_id_seq;
|
3
|
+
DROP TABLE funny_jokes;
|
4
|
+
DROP TABLE companies;
|
5
|
+
DROP SEQUENCE companies_nonstd_seq;
|
6
|
+
DROP TABLE topics;
|
7
|
+
DROP TABLE developers;
|
8
|
+
DROP TABLE projects;
|
9
|
+
DROP TABLE developers_projects;
|
10
|
+
DROP TABLE customers;
|
11
|
+
DROP TABLE orders;
|
12
|
+
DROP TABLE movies;
|
13
|
+
DROP TABLE subscribers;
|
14
|
+
DROP TABLE booleantests;
|
15
|
+
DROP TABLE auto_id_tests;
|
16
|
+
DROP TABLE entrants;
|
17
|
+
DROP TABLE colnametests;
|
18
|
+
DROP TABLE mixins;
|
19
|
+
DROP TABLE people;
|
20
|
+
DROP TABLE readers;
|
21
|
+
DROP TABLE binaries;
|
22
|
+
DROP TABLE computers;
|
23
|
+
DROP TABLE posts;
|
24
|
+
DROP TABLE comments;
|
25
|
+
DROP TABLE authors;
|
26
|
+
DROP TABLE tasks;
|
27
|
+
DROP TABLE categories;
|
28
|
+
DROP TABLE categories_posts;
|
29
|
+
DROP TABLE defaults;
|
30
|
+
DROP TABLE fk_test_has_fk;
|
31
|
+
DROP TABLE fk_test_has_pk;
|
32
|
+
DROP TABLE geometrics;
|
33
|
+
DROP TABLE keyboards;
|
34
|
+
DROP TABLE legacy_things;
|
35
|
+
DROP TABLE numeric_data;
|
36
|
+
DROP TABLE column_data;
|
37
|
+
DROP TABLE mixed_case_monkeys;
|