diff options
Diffstat (limited to 'activerecord/test/fixtures')
8 files changed, 67 insertions, 0 deletions
diff --git a/activerecord/test/fixtures/db_definitions/db2.sql b/activerecord/test/fixtures/db_definitions/db2.sql index 35efa3f6c7..1097568ce3 100644 --- a/activerecord/test/fixtures/db_definitions/db2.sql +++ b/activerecord/test/fixtures/db_definitions/db2.sql @@ -164,3 +164,14 @@ CREATE TABLE categories_posts ( category_id int NOT NULL, post_id int NOT NULL ); + +CREATE TABLE fk_test_has_pk ( + id INTEGER NOT NULL PRIMARY KEY +); + +CREATE TABLE fk_test_has_fk ( + id INTEGER NOT NULL PRIMARY KEY, + fk_id INTEGER NOT NULL, + + FOREIGN KEY (fk_id) REFERENCES fk_test_has_pk(id) +); diff --git a/activerecord/test/fixtures/db_definitions/mysql.sql b/activerecord/test/fixtures/db_definitions/mysql.sql index 294f227be3..da4a69252f 100755 --- a/activerecord/test/fixtures/db_definitions/mysql.sql +++ b/activerecord/test/fixtures/db_definitions/mysql.sql @@ -166,3 +166,14 @@ CREATE TABLE `categories_posts` ( `category_id` int(11) NOT NULL, `post_id` int(11) NOT NULL ); + +CREATE TABLE `fk_test_has_pk` ( + `id` INTEGER NOT NULL PRIMARY KEY +); + +CREATE TABLE `fk_test_has_fk` ( + `id` INTEGER NOT NULL PRIMARY KEY, + `fk_id` INTEGER NOT NULL, + + FOREIGN KEY (`fk_id`) REFERENCES `fk_test_has_pk`(`id`) +); diff --git a/activerecord/test/fixtures/db_definitions/oci.sql b/activerecord/test/fixtures/db_definitions/oci.sql index 29e6c76e2a..62f9ae9fb4 100644 --- a/activerecord/test/fixtures/db_definitions/oci.sql +++ b/activerecord/test/fixtures/db_definitions/oci.sql @@ -202,3 +202,12 @@ 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 ); + +create table fk_test_has_pk ( + id integer not null primary key +); + +create table fk_test_has_fk ( + id integer not null primary key, + fk_id integer not null references fk_test_has_fk initially deferred disable, +); diff --git a/activerecord/test/fixtures/db_definitions/postgresql.sql b/activerecord/test/fixtures/db_definitions/postgresql.sql index 2bc18dfb2b..9b57866368 100644 --- a/activerecord/test/fixtures/db_definitions/postgresql.sql +++ b/activerecord/test/fixtures/db_definitions/postgresql.sql @@ -183,3 +183,12 @@ CREATE TABLE categories_posts ( category_id integer NOT NULL, post_id integer NOT NULL ); + +CREATE TABLE fk_test_has_pk ( + id INTEGER NOT NULL PRIMARY KEY +); + +CREATE TABLE fk_test_has_fk ( + id INTEGER NOT NULL PRIMARY KEY, + fk_id INTEGER NOT NULL REFERENCES fk_test_has_fk(id) +); diff --git a/activerecord/test/fixtures/db_definitions/sqlite.sql b/activerecord/test/fixtures/db_definitions/sqlite.sql index 33c85b4d1c..4507e2c4b2 100644 --- a/activerecord/test/fixtures/db_definitions/sqlite.sql +++ b/activerecord/test/fixtures/db_definitions/sqlite.sql @@ -151,3 +151,14 @@ CREATE TABLE 'categories_posts' ( 'category_id' INTEGER NOT NULL, 'post_id' INTEGER NOT NULL ); + +CREATE TABLE 'fk_test_has_pk' ( + 'id' INTEGER NOT NULL PRIMARY KEY +); + +CREATE TABLE 'fk_test_has_fk' ( + 'id' INTEGER NOT NULL PRIMARY KEY, + 'fk_id' INTEGER NOT NULL, + + FOREIGN KEY ('fk_id') REFERENCES 'fk_test_has_pk'('id') +); diff --git a/activerecord/test/fixtures/db_definitions/sqlserver.sql b/activerecord/test/fixtures/db_definitions/sqlserver.sql index c6cec8312d..776ac23610 100644 --- a/activerecord/test/fixtures/db_definitions/sqlserver.sql +++ b/activerecord/test/fixtures/db_definitions/sqlserver.sql @@ -151,3 +151,14 @@ CREATE TABLE categories_posts ( category_id int NOT NULL, post_id int NOT NULL ); + +CREATE TABLE fk_test_has_pk ( + id INTEGER NOT NULL PRIMARY KEY +); + +CREATE TABLE fk_test_has_fk ( + id INTEGER NOT NULL PRIMARY KEY, + fk_id INTEGER NOT NULL, + + FOREIGN KEY (fk_id) REFERENCES fk_test_has_pk(id) +); diff --git a/activerecord/test/fixtures/fk_test_has_fk.yml b/activerecord/test/fixtures/fk_test_has_fk.yml new file mode 100644 index 0000000000..67d914e130 --- /dev/null +++ b/activerecord/test/fixtures/fk_test_has_fk.yml @@ -0,0 +1,3 @@ +first: + id: 1 + fk_id: 1 diff --git a/activerecord/test/fixtures/fk_test_has_pk.yml b/activerecord/test/fixtures/fk_test_has_pk.yml new file mode 100644 index 0000000000..c93952180b --- /dev/null +++ b/activerecord/test/fixtures/fk_test_has_pk.yml @@ -0,0 +1,2 @@ +first: + id: 1
\ No newline at end of file |