diff options
Diffstat (limited to 'activerecord/test/fixtures')
18 files changed, 95 insertions, 41 deletions
diff --git a/activerecord/test/fixtures/categories.yml b/activerecord/test/fixtures/categories.yml new file mode 100644 index 0000000000..2ce34d6f9f --- /dev/null +++ b/activerecord/test/fixtures/categories.yml @@ -0,0 +1,7 @@ +general: + id: 1 + name: General + +technology: + id: 2 + name: Technology diff --git a/activerecord/test/fixtures/categories_posts.yml b/activerecord/test/fixtures/categories_posts.yml new file mode 100644 index 0000000000..04eeb8f46c --- /dev/null +++ b/activerecord/test/fixtures/categories_posts.yml @@ -0,0 +1,11 @@ +general_welcome: + category_id: 1 + post_id: 1 + +technology_welcome: + category_id: 2 + post_id: 1 + +general_thinking: + category_id: 1 + post_id: 2 diff --git a/activerecord/test/fixtures/category.rb b/activerecord/test/fixtures/category.rb new file mode 100644 index 0000000000..751413c0db --- /dev/null +++ b/activerecord/test/fixtures/category.rb @@ -0,0 +1,3 @@ +class Category < ActiveRecord::Base + has_and_belongs_to_many :posts +end diff --git a/activerecord/test/fixtures/db_definitions/db2.drop.sql b/activerecord/test/fixtures/db_definitions/db2.drop.sql index e718d4b321..844bf3e2f8 100644 --- a/activerecord/test/fixtures/db_definitions/db2.drop.sql +++ b/activerecord/test/fixtures/db_definitions/db2.drop.sql @@ -19,4 +19,6 @@ DROP TABLE posts; DROP TABLE comments; DROP TABLE authors; DROP TABLE tasks; +DROP TABLE categories; +DROP TABLE categories_posts; diff --git a/activerecord/test/fixtures/db_definitions/db2.sql b/activerecord/test/fixtures/db_definitions/db2.sql index a24318bf4b..35efa3f6c7 100644 --- a/activerecord/test/fixtures/db_definitions/db2.sql +++ b/activerecord/test/fixtures/db_definitions/db2.sql @@ -154,3 +154,13 @@ CREATE TABLE tasks ( starting timestamp default NULL, ending timestamp default NULL ); + +CREATE TABLE categories ( + id int generated by default as identity (start with +10000), + name varchar(255) NOT NULL +); + +CREATE TABLE categories_posts ( + category_id int NOT NULL, + post_id int NOT NULL +); diff --git a/activerecord/test/fixtures/db_definitions/drop_oracle_tables.sql b/activerecord/test/fixtures/db_definitions/drop_oracle_tables.sql deleted file mode 100644 index 2eb574df75..0000000000 --- a/activerecord/test/fixtures/db_definitions/drop_oracle_tables.sql +++ /dev/null @@ -1,37 +0,0 @@ -DROP TABLE accounts; -DROP SEQUENCE accounts_id; -DROP TABLE companies; -DROP SEQUENCE companies_id; -DROP TABLE topics; -DROP SEQUENCE topics_id; -DROP TABLE developers; -DROP SEQUENCE developers_id; -DROP TABLE projects; -DROP SEQUENCE projects_id; -DROP TABLE developers_projects; -DROP SEQUENCE developers_projects_id; -DROP TABLE customers; -DROP SEQUENCE customers_id; -DROP TABLE movies; -DROP SEQUENCE movies_id; -DROP TABLE subscribers; -DROP SEQUENCE subscribers_id; -DROP TABLE booleantests; -DROP SEQUENCE booleantests_id; -DROP TABLE auto_id_tests; -DROP SEQUENCE auto_id_tests_id; -DROP TABLE entrants; -DROP SEQUENCE entrants_id; -DROP TABLE colnametests; -DROP SEQUENCE colnametests_id; -DROP TABLE mixins; -DROP SEQUENCE mixins_id; -DROP TABLE people; -DROP SEQUENCE people_id; -DROP TABLE binaries; -DROP SEQUENCE binaries_id; -DROP TABLE computers; -DROP SEQUENCE computers_id; -DROP TABLE tasks; -DROP SEQUENCE tasks_id; -EXIT; diff --git a/activerecord/test/fixtures/db_definitions/drop_oracle_tables2.sql b/activerecord/test/fixtures/db_definitions/drop_oracle_tables2.sql deleted file mode 100644 index 934026dc89..0000000000 --- a/activerecord/test/fixtures/db_definitions/drop_oracle_tables2.sql +++ /dev/null @@ -1,3 +0,0 @@ -DROP TABLE courses; -DROP SEQUENCE courses_id; -EXIT; diff --git a/activerecord/test/fixtures/db_definitions/mysql.drop.sql b/activerecord/test/fixtures/db_definitions/mysql.drop.sql index d8eaf9b29c..12103a6d9e 100644 --- a/activerecord/test/fixtures/db_definitions/mysql.drop.sql +++ b/activerecord/test/fixtures/db_definitions/mysql.drop.sql @@ -19,3 +19,5 @@ DROP TABLE tasks; DROP TABLE posts; DROP TABLE comments; DROP TABLE authors; +DROP TABLE categories; +DROP TABLE categories_posts; diff --git a/activerecord/test/fixtures/db_definitions/mysql.sql b/activerecord/test/fixtures/db_definitions/mysql.sql index 17d443bffd..865e67a83f 100755 --- a/activerecord/test/fixtures/db_definitions/mysql.sql +++ b/activerecord/test/fixtures/db_definitions/mysql.sql @@ -155,3 +155,13 @@ CREATE TABLE `tasks` ( `ending` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`) ); + +CREATE TABLE `categories` ( + `id` int(11) NOT NULL auto_increment, + `name` VARCHAR(255) NOT NULL +); + +CREATE TABLE `categories_posts` ( + `category_id` int(11) NOT NULL, + `post_id` int(11) NOT NULL +); diff --git a/activerecord/test/fixtures/db_definitions/oci.drop.sql b/activerecord/test/fixtures/db_definitions/oci.drop.sql index c98a8790c9..532a2f4208 100644 --- a/activerecord/test/fixtures/db_definitions/oci.drop.sql +++ b/activerecord/test/fixtures/db_definitions/oci.drop.sql @@ -18,4 +18,6 @@ drop table posts; drop table comments; drop table authors; drop table computers; +drop table categories; +drop table categories_posts; drop sequence rails_sequence; diff --git a/activerecord/test/fixtures/db_definitions/oci.sql b/activerecord/test/fixtures/db_definitions/oci.sql index bb4726caaa..29e6c76e2a 100644 --- a/activerecord/test/fixtures/db_definitions/oci.sql +++ b/activerecord/test/fixtures/db_definitions/oci.sql @@ -192,3 +192,13 @@ create table tasks ( starting date default null, ending date default null ); + +create table categories ( + id integer not null primary key, + name varchar(255) default null +); + +create table categories_posts ( + category_id integer not null references developers initially deferred disable, + post_id int integer not null references developers initially deferred disable +); diff --git a/activerecord/test/fixtures/db_definitions/postgresql.drop.sql b/activerecord/test/fixtures/db_definitions/postgresql.drop.sql index e718d4b321..844bf3e2f8 100644 --- a/activerecord/test/fixtures/db_definitions/postgresql.drop.sql +++ b/activerecord/test/fixtures/db_definitions/postgresql.drop.sql @@ -19,4 +19,6 @@ DROP TABLE posts; DROP TABLE comments; DROP TABLE authors; DROP TABLE tasks; +DROP TABLE categories; +DROP TABLE categories_posts; diff --git a/activerecord/test/fixtures/db_definitions/postgresql.sql b/activerecord/test/fixtures/db_definitions/postgresql.sql index 01d6ee288c..ae41f80788 100644 --- a/activerecord/test/fixtures/db_definitions/postgresql.sql +++ b/activerecord/test/fixtures/db_definitions/postgresql.sql @@ -173,3 +173,13 @@ CREATE TABLE taske ( ending timestamp, PRIMARY KEY (id) ); + +CREATE TABLE categories ( + id serial, + name varchar(255) +); + +CREATE TABLE categories_posts ( + category_id integer NOT NULL, + post_id int integer NOT NULL +); diff --git a/activerecord/test/fixtures/db_definitions/sqlite.drop.sql b/activerecord/test/fixtures/db_definitions/sqlite.drop.sql index d8eaf9b29c..12103a6d9e 100644 --- a/activerecord/test/fixtures/db_definitions/sqlite.drop.sql +++ b/activerecord/test/fixtures/db_definitions/sqlite.drop.sql @@ -19,3 +19,5 @@ DROP TABLE tasks; DROP TABLE posts; DROP TABLE comments; DROP TABLE authors; +DROP TABLE categories; +DROP TABLE categories_posts; diff --git a/activerecord/test/fixtures/db_definitions/sqlite.sql b/activerecord/test/fixtures/db_definitions/sqlite.sql index 0d05ca6932..2a26ff8c37 100644 --- a/activerecord/test/fixtures/db_definitions/sqlite.sql +++ b/activerecord/test/fixtures/db_definitions/sqlite.sql @@ -142,3 +142,12 @@ CREATE TABLE 'tasks' ( 'ending' DATETIME DEFAULT NULL ); +CREATE TABLE 'categories' ( + 'id' INTEGER NOT NULL PRIMARY KEY, + 'name' VARCHAR(255) NOT NULL +); + +CREATE TABLE 'categories_posts' ( + 'category_id' INTEGER NOT NULL, + 'post_id' INTEGER NOT NULL +); diff --git a/activerecord/test/fixtures/db_definitions/sqlserver.drop.sql b/activerecord/test/fixtures/db_definitions/sqlserver.drop.sql index 2ec7dbf026..efa98fe500 100644 --- a/activerecord/test/fixtures/db_definitions/sqlserver.drop.sql +++ b/activerecord/test/fixtures/db_definitions/sqlserver.drop.sql @@ -19,3 +19,5 @@ DROP TABLE posts; DROP TABLE comments; DROP TABLE authors; DROP TABLE tasks; +DROP TABLE categories; +DROP TABLE categories_posts; diff --git a/activerecord/test/fixtures/db_definitions/sqlserver.sql b/activerecord/test/fixtures/db_definitions/sqlserver.sql index 8e0d78bb61..3d93dffe20 100644 --- a/activerecord/test/fixtures/db_definitions/sqlserver.sql +++ b/activerecord/test/fixtures/db_definitions/sqlserver.sql @@ -141,3 +141,13 @@ CREATE TABLE tasks ( starting datetime default NULL, ending datetime default NULL ); + +CREATE TABLE categories ( + id int NOT NULL IDENTITY(1, 1) PRIMARY KEY, + name varchar(255) +); + +CREATE TABLE categories_posts ( + category_id int NOT NULL, + post_id int int NOT NULL +); diff --git a/activerecord/test/fixtures/post.rb b/activerecord/test/fixtures/post.rb index 3c0ef927dc..ce9abcc693 100644 --- a/activerecord/test/fixtures/post.rb +++ b/activerecord/test/fixtures/post.rb @@ -1,6 +1,8 @@ class Post < ActiveRecord::Base belongs_to :author has_many :comments + has_and_belongs_to_many :categories end -class SpecialPost < Post; end
\ No newline at end of file +class SpecialPost < Post +end
\ No newline at end of file |