2005-12-02 06:03:43 +00:00
|
|
|
ActiveRecord::Schema.define do
|
|
|
|
|
2006-07-08 17:13:21 +00:00
|
|
|
# For Firebird, set the sequence values 10000 when create_table is called;
|
|
|
|
# this prevents primary key collisions between "normally" created records
|
|
|
|
# and fixture-based (YAML) records.
|
|
|
|
if adapter_name == "Firebird"
|
|
|
|
def create_table(*args, &block)
|
|
|
|
ActiveRecord::Base.connection.create_table(*args, &block)
|
|
|
|
ActiveRecord::Base.connection.execute "SET GENERATOR #{args.first}_seq TO 10000"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2006-03-09 17:23:57 +00:00
|
|
|
create_table :taggings, :force => true do |t|
|
|
|
|
t.column :tag_id, :integer
|
2006-03-18 22:38:49 +00:00
|
|
|
t.column :super_tag_id, :integer
|
2006-03-09 17:23:57 +00:00
|
|
|
t.column :taggable_type, :string
|
|
|
|
t.column :taggable_id, :integer
|
2005-12-02 06:03:43 +00:00
|
|
|
end
|
|
|
|
|
2006-03-09 17:23:57 +00:00
|
|
|
create_table :tags, :force => true do |t|
|
|
|
|
t.column :name, :string
|
2006-03-04 15:11:17 +00:00
|
|
|
t.column :taggings_count, :integer, :default => 0
|
2005-12-02 06:03:43 +00:00
|
|
|
end
|
|
|
|
|
2006-03-09 17:23:57 +00:00
|
|
|
create_table :categorizations, :force => true do |t|
|
|
|
|
t.column :category_id, :integer
|
|
|
|
t.column :post_id, :integer
|
|
|
|
t.column :author_id, :integer
|
2005-12-11 18:06:51 +00:00
|
|
|
end
|
|
|
|
|
2006-03-04 15:11:17 +00:00
|
|
|
add_column :posts, :taggings_count, :integer, :default => 0
|
2006-03-19 19:32:07 +00:00
|
|
|
add_column :authors, :author_address_id, :integer
|
|
|
|
|
|
|
|
create_table :author_addresses, :force => true do |t|
|
|
|
|
t.column :author_address_id, :integer
|
|
|
|
end
|
2006-03-04 15:11:17 +00:00
|
|
|
|
2006-03-21 01:07:16 +00:00
|
|
|
create_table :author_favorites, :force => true do |t|
|
|
|
|
t.column :author_id, :integer
|
|
|
|
t.column :favorite_author_id, :integer
|
|
|
|
end
|
2006-08-16 18:10:52 +00:00
|
|
|
|
|
|
|
create_table :vertices, :force => true do |t|
|
|
|
|
t.column :label, :string
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table :edges, :force => true do |t|
|
|
|
|
t.column :source_id, :integer, :null => false
|
|
|
|
t.column :sink_id, :integer, :null => false
|
|
|
|
end
|
2006-08-16 18:22:51 +00:00
|
|
|
add_index :edges, [:source_id, :sink_id], :unique => true, :name => 'unique_edge_index'
|
2006-09-04 00:02:38 +00:00
|
|
|
|
|
|
|
create_table :lock_without_defaults, :force => true do |t|
|
|
|
|
t.column :lock_version, :integer
|
|
|
|
end
|
|
|
|
|
2006-11-01 20:28:48 +00:00
|
|
|
create_table :lock_without_defaults_cust, :force => true do |t|
|
2006-09-04 00:02:38 +00:00
|
|
|
t.column :custom_lock_version, :integer
|
|
|
|
end
|
2006-11-14 03:32:16 +00:00
|
|
|
|
|
|
|
# For sqlite 3.1.0+, make a table with a autoincrement column
|
|
|
|
if adapter_name == 'SQLite' and supports_autoincrement?
|
|
|
|
create_table :table_with_autoincrement, :force => true do |t|
|
|
|
|
t.column :name, :string
|
|
|
|
end
|
|
|
|
end
|
2006-07-08 17:13:21 +00:00
|
|
|
end
|