2008-04-21 06:00:01 -04:00
|
|
|
ActiveRecord::Schema.define do
|
2013-08-10 12:51:25 -04:00
|
|
|
create_table :table_with_autoincrement, :force => true do |t|
|
|
|
|
t.column :name, :string
|
2008-04-21 06:00:01 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
execute "DROP TABLE fk_test_has_fk" rescue nil
|
|
|
|
execute "DROP TABLE fk_test_has_pk" rescue nil
|
|
|
|
execute <<_SQL
|
|
|
|
CREATE TABLE 'fk_test_has_pk' (
|
2014-06-20 05:54:17 -04:00
|
|
|
'pk_id' INTEGER NOT NULL PRIMARY KEY
|
2008-04-21 06:00:01 -04:00
|
|
|
);
|
|
|
|
_SQL
|
|
|
|
|
|
|
|
execute <<_SQL
|
|
|
|
CREATE TABLE 'fk_test_has_fk' (
|
|
|
|
'id' INTEGER NOT NULL PRIMARY KEY,
|
|
|
|
'fk_id' INTEGER NOT NULL,
|
|
|
|
|
2014-06-20 05:54:17 -04:00
|
|
|
FOREIGN KEY ('fk_id') REFERENCES 'fk_test_has_pk'('pk_id')
|
2008-04-21 06:00:01 -04:00
|
|
|
);
|
|
|
|
_SQL
|
2014-06-20 05:54:17 -04:00
|
|
|
end
|