2008-04-21 06:00:01 -04:00
|
|
|
ActiveRecord::Schema.define do
|
2012-05-12 07:12:15 -04:00
|
|
|
# For sqlite 3.1.0+, make a table with an autoincrement column
|
2008-04-21 06:00:01 -04:00
|
|
|
if supports_autoincrement?
|
|
|
|
create_table :table_with_autoincrement, :force => true do |t|
|
|
|
|
t.column :name, :string
|
|
|
|
end
|
|
|
|
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' (
|
|
|
|
'id' INTEGER NOT NULL PRIMARY KEY
|
|
|
|
);
|
|
|
|
_SQL
|
|
|
|
|
|
|
|
execute <<_SQL
|
|
|
|
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')
|
|
|
|
);
|
|
|
|
_SQL
|
|
|
|
end
|