1 ActiveRecord
::Schema.define
do
2 # For sqlite 3.1.0+, make a table with a autoincrement column
3 if supports_autoincrement
?
4 create_table
:table_with_autoincrement, :force => true do |t
|
5 t
.column
:name, :string
9 execute
"DROP TABLE fk_test_has_fk" rescue nil
10 execute
"DROP TABLE fk_test_has_pk" rescue nil
12 CREATE TABLE 'fk_test_has_pk' (
13 'id' INTEGER NOT NULL PRIMARY KEY
18 CREATE TABLE 'fk_test_has_fk' (
19 'id' INTEGER NOT NULL PRIMARY KEY,
20 'fk_id' INTEGER NOT NULL,
22 FOREIGN KEY ('fk_id') REFERENCES 'fk_test_has_pk'('id')