2008-04-21 06:00:01 -04:00
|
|
|
ActiveRecord::Schema.define do
|
|
|
|
def except(adapter_names_to_exclude)
|
|
|
|
unless [adapter_names_to_exclude].flatten.include?(adapter_name)
|
|
|
|
yield
|
2007-10-18 21:52:50 -04:00
|
|
|
end
|
2008-04-21 06:00:01 -04:00
|
|
|
end
|
2008-01-18 02:29:00 -05:00
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
#put adapter specific setup here
|
|
|
|
case adapter_name
|
|
|
|
# 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.
|
|
|
|
when "Firebird"
|
|
|
|
def create_table(*args, &block)
|
|
|
|
ActiveRecord::Base.connection.create_table(*args, &block)
|
|
|
|
ActiveRecord::Base.connection.execute "SET GENERATOR #{args.first}_seq TO 10000"
|
2007-10-18 21:52:50 -04:00
|
|
|
end
|
2008-04-21 06:00:01 -04:00
|
|
|
end
|
2008-01-18 02:29:00 -05:00
|
|
|
|
2007-10-18 21:52:50 -04:00
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
# Please keep these create table statements in alphabetical order
|
|
|
|
# unless the ordering matters. In which case, define them below
|
|
|
|
create_table :accounts, :force => true do |t|
|
|
|
|
t.integer :firm_id
|
2009-07-11 14:04:18 -04:00
|
|
|
t.string :firm_name
|
2008-04-21 06:00:01 -04:00
|
|
|
t.integer :credit_limit
|
|
|
|
end
|
2007-10-18 21:52:50 -04:00
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :audit_logs, :force => true do |t|
|
|
|
|
t.column :message, :string, :null=>false
|
|
|
|
t.column :developer_id, :integer, :null=>false
|
|
|
|
end
|
2007-10-18 21:52:50 -04:00
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :authors, :force => true do |t|
|
|
|
|
t.string :name, :null => false
|
|
|
|
t.integer :author_address_id
|
|
|
|
t.integer :author_address_extra_id
|
|
|
|
end
|
2007-10-18 21:52:50 -04:00
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :author_addresses, :force => true do |t|
|
|
|
|
end
|
2008-01-18 02:29:00 -05:00
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :author_favorites, :force => true do |t|
|
|
|
|
t.column :author_id, :integer
|
|
|
|
t.column :favorite_author_id, :integer
|
|
|
|
end
|
2008-01-18 02:29:00 -05:00
|
|
|
|
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :auto_id_tests, :force => true, :id => false do |t|
|
|
|
|
t.primary_key :auto_id
|
|
|
|
t.integer :value
|
|
|
|
end
|
2008-01-18 02:29:00 -05:00
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :binaries, :force => true do |t|
|
|
|
|
t.binary :data
|
|
|
|
end
|
2008-01-18 02:29:00 -05:00
|
|
|
|
2009-01-31 20:44:30 -05:00
|
|
|
create_table :birds, :force => true do |t|
|
|
|
|
t.string :name
|
2009-05-09 23:02:00 -04:00
|
|
|
t.string :color
|
2009-01-31 20:44:30 -05:00
|
|
|
t.integer :pirate_id
|
|
|
|
end
|
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :books, :force => true do |t|
|
|
|
|
t.column :name, :string
|
|
|
|
end
|
2008-01-18 02:29:00 -05:00
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :booleantests, :force => true do |t|
|
2008-08-18 18:56:37 -04:00
|
|
|
t.boolean :value
|
2008-04-21 06:00:01 -04:00
|
|
|
end
|
2008-01-18 02:29:00 -05:00
|
|
|
|
2009-04-20 16:48:02 -04:00
|
|
|
create_table "CamelCase", :force => true do |t|
|
|
|
|
t.string :name
|
|
|
|
end
|
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :categories, :force => true do |t|
|
|
|
|
t.string :name, :null => false
|
|
|
|
t.string :type
|
2008-06-26 12:46:33 -04:00
|
|
|
t.integer :categorizations_count
|
2008-04-21 06:00:01 -04:00
|
|
|
end
|
2008-01-18 02:29:00 -05:00
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :categories_posts, :force => true, :id => false do |t|
|
|
|
|
t.integer :category_id, :null => false
|
|
|
|
t.integer :post_id, :null => false
|
|
|
|
end
|
2007-10-18 21:52:50 -04:00
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :categorizations, :force => true do |t|
|
|
|
|
t.column :category_id, :integer
|
|
|
|
t.column :post_id, :integer
|
|
|
|
t.column :author_id, :integer
|
|
|
|
end
|
2008-01-18 02:29:00 -05:00
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :citations, :force => true do |t|
|
|
|
|
t.column :book1_id, :integer
|
|
|
|
t.column :book2_id, :integer
|
|
|
|
end
|
2007-10-18 21:52:50 -04:00
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :clubs, :force => true do |t|
|
|
|
|
t.string :name
|
|
|
|
end
|
2008-01-18 02:29:00 -05:00
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :colnametests, :force => true do |t|
|
|
|
|
t.integer :references, :null => false
|
|
|
|
end
|
2008-01-18 02:29:00 -05:00
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :comments, :force => true do |t|
|
|
|
|
t.integer :post_id, :null => false
|
2009-03-22 17:50:05 -04:00
|
|
|
# use VARCHAR2(4000) instead of CLOB datatype as CLOB data type has many limitations in
|
|
|
|
# Oracle SELECT WHERE clause which causes many unit test failures
|
|
|
|
if current_adapter?(:OracleAdapter)
|
|
|
|
t.string :body, :null => false, :limit => 4000
|
|
|
|
else
|
|
|
|
t.text :body, :null => false
|
|
|
|
end
|
2008-04-21 06:00:01 -04:00
|
|
|
t.string :type
|
|
|
|
end
|
2007-10-18 21:52:50 -04:00
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :companies, :force => true do |t|
|
|
|
|
t.string :type
|
|
|
|
t.string :ruby_type
|
|
|
|
t.integer :firm_id
|
2008-06-01 02:19:40 -04:00
|
|
|
t.string :firm_name
|
2008-04-21 06:00:01 -04:00
|
|
|
t.string :name
|
|
|
|
t.integer :client_of
|
|
|
|
t.integer :rating, :default => 1
|
|
|
|
end
|
2007-10-18 21:52:50 -04:00
|
|
|
|
2009-04-20 11:47:31 -04:00
|
|
|
add_index :companies, [:firm_id, :type, :rating, :ruby_type], :name => "company_index"
|
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :computers, :force => true do |t|
|
|
|
|
t.integer :developer, :null => false
|
|
|
|
t.integer :extendedWarranty, :null => false
|
|
|
|
end
|
2007-10-18 21:52:50 -04:00
|
|
|
|
2009-08-08 18:48:11 -04:00
|
|
|
create_table :contracts, :force => true do |t|
|
|
|
|
t.integer :developer_id
|
|
|
|
t.integer :company_id
|
|
|
|
end
|
2007-10-18 21:52:50 -04:00
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :customers, :force => true do |t|
|
|
|
|
t.string :name
|
|
|
|
t.integer :balance, :default => 0
|
|
|
|
t.string :address_street
|
|
|
|
t.string :address_city
|
|
|
|
t.string :address_country
|
|
|
|
t.string :gps_location
|
|
|
|
end
|
2007-10-18 21:52:50 -04:00
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :developers, :force => true do |t|
|
|
|
|
t.string :name
|
|
|
|
t.integer :salary, :default => 70000
|
|
|
|
t.datetime :created_at
|
|
|
|
t.datetime :updated_at
|
|
|
|
end
|
2007-10-18 21:52:50 -04:00
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :developers_projects, :force => true, :id => false do |t|
|
|
|
|
t.integer :developer_id, :null => false
|
|
|
|
t.integer :project_id, :null => false
|
|
|
|
t.date :joined_on
|
|
|
|
t.integer :access_level, :default => 1
|
|
|
|
end
|
2007-10-18 21:52:50 -04:00
|
|
|
|
2009-11-23 13:05:35 -05:00
|
|
|
create_table :edges, :force => true, :id => false do |t|
|
2008-04-21 06:00:01 -04:00
|
|
|
t.column :source_id, :integer, :null => false
|
|
|
|
t.column :sink_id, :integer, :null => false
|
|
|
|
end
|
|
|
|
add_index :edges, [:source_id, :sink_id], :unique => true, :name => 'unique_edge_index'
|
2007-10-18 21:52:50 -04:00
|
|
|
|
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :entrants, :force => true do |t|
|
|
|
|
t.string :name, :null => false
|
|
|
|
t.integer :course_id, :null => false
|
|
|
|
end
|
2007-10-18 21:52:50 -04:00
|
|
|
|
2009-07-15 16:22:25 -04:00
|
|
|
create_table :essays, :force => true do |t|
|
|
|
|
t.string :name
|
|
|
|
t.string :writer_id
|
|
|
|
t.string :writer_type
|
|
|
|
end
|
|
|
|
|
2009-03-07 08:52:17 -05:00
|
|
|
create_table :events, :force => true do |t|
|
|
|
|
t.string :title, :limit => 5
|
|
|
|
end
|
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :funny_jokes, :force => true do |t|
|
|
|
|
t.string :name
|
2007-10-18 21:52:50 -04:00
|
|
|
end
|
|
|
|
|
2009-01-15 16:30:44 -05:00
|
|
|
create_table :goofy_string_id, :force => true, :id => false do |t|
|
|
|
|
t.string :id, :null => false
|
|
|
|
t.string :info
|
|
|
|
end
|
|
|
|
|
2009-10-01 02:17:50 -04:00
|
|
|
create_table :invoices, :force => true do |t|
|
|
|
|
t.integer :balance
|
|
|
|
t.datetime :updated_at
|
|
|
|
end
|
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :items, :force => true do |t|
|
|
|
|
t.column :name, :integer
|
2006-07-08 13:13:21 -04:00
|
|
|
end
|
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :inept_wizards, :force => true do |t|
|
|
|
|
t.column :name, :string, :null => false
|
|
|
|
t.column :city, :string, :null => false
|
|
|
|
t.column :type, :string
|
2005-12-02 01:03:43 -05:00
|
|
|
end
|
|
|
|
|
2008-04-25 18:23:48 -04:00
|
|
|
|
|
|
|
create_table :jobs, :force => true do |t|
|
|
|
|
t.integer :ideal_reference_id
|
|
|
|
end
|
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :keyboards, :force => true, :id => false do |t|
|
|
|
|
t.primary_key :key_number
|
|
|
|
t.string :name
|
2005-12-02 01:03:43 -05:00
|
|
|
end
|
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :legacy_things, :force => true do |t|
|
|
|
|
t.integer :tps_report_number
|
|
|
|
t.integer :version, :null => false, :default => 0
|
2005-12-11 13:06:51 -05:00
|
|
|
end
|
|
|
|
|
2009-10-01 02:17:50 -04:00
|
|
|
create_table :line_items, :force => true do |t|
|
|
|
|
t.integer :invoice_id
|
|
|
|
t.integer :amount
|
|
|
|
end
|
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :lock_without_defaults, :force => true do |t|
|
|
|
|
t.column :lock_version, :integer
|
|
|
|
end
|
2006-03-19 14:32:07 -05:00
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :lock_without_defaults_cust, :force => true do |t|
|
|
|
|
t.column :custom_lock_version, :integer
|
2006-03-19 14:32:07 -05:00
|
|
|
end
|
2006-03-04 10:11:17 -05:00
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :mateys, :id => false, :force => true do |t|
|
|
|
|
t.column :pirate_id, :integer
|
|
|
|
t.column :target_id, :integer
|
|
|
|
t.column :weight, :integer
|
2006-03-20 20:07:16 -05:00
|
|
|
end
|
2006-08-16 14:10:52 -04:00
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :members, :force => true do |t|
|
|
|
|
t.string :name
|
2008-12-02 16:21:21 -05:00
|
|
|
t.integer :member_type_id
|
2006-08-16 14:10:52 -04:00
|
|
|
end
|
|
|
|
|
2008-11-15 01:59:12 -05:00
|
|
|
create_table :member_details, :force => true do |t|
|
|
|
|
t.integer :member_id
|
|
|
|
t.integer :organization_id
|
|
|
|
t.string :extra_data
|
|
|
|
end
|
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :memberships, :force => true do |t|
|
|
|
|
t.datetime :joined_on
|
|
|
|
t.integer :club_id, :member_id
|
|
|
|
t.boolean :favourite, :default => false
|
|
|
|
t.string :type
|
2006-08-16 14:10:52 -04:00
|
|
|
end
|
2006-09-03 20:02:38 -04:00
|
|
|
|
2008-12-02 16:21:21 -05:00
|
|
|
create_table :member_types, :force => true do |t|
|
|
|
|
t.string :name
|
|
|
|
end
|
|
|
|
|
2008-04-25 18:23:48 -04:00
|
|
|
create_table :references, :force => true do |t|
|
|
|
|
t.integer :person_id
|
|
|
|
t.integer :job_id
|
|
|
|
t.boolean :favourite
|
2008-04-30 16:04:08 -04:00
|
|
|
t.integer :lock_version, :default => 0
|
2008-04-25 18:23:48 -04:00
|
|
|
end
|
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :minimalistics, :force => true do |t|
|
2006-09-03 20:02:38 -04:00
|
|
|
end
|
2008-01-18 02:29:00 -05:00
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :mixed_case_monkeys, :force => true, :id => false do |t|
|
|
|
|
t.primary_key :monkeyID
|
|
|
|
t.integer :fleaCount
|
2006-09-03 20:02:38 -04:00
|
|
|
end
|
2008-01-18 02:29:00 -05:00
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :mixins, :force => true do |t|
|
|
|
|
t.integer :parent_id
|
|
|
|
t.integer :pos
|
|
|
|
t.datetime :created_at
|
|
|
|
t.datetime :updated_at
|
|
|
|
t.integer :lft
|
|
|
|
t.integer :rgt
|
|
|
|
t.integer :root_id
|
|
|
|
t.string :type
|
2007-06-25 18:42:19 -04:00
|
|
|
end
|
2006-11-13 22:32:16 -05:00
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :movies, :force => true, :id => false do |t|
|
|
|
|
t.primary_key :movieid
|
|
|
|
t.string :name
|
2006-11-13 22:32:16 -05:00
|
|
|
end
|
2008-01-18 02:29:00 -05:00
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :numeric_data, :force => true do |t|
|
|
|
|
t.decimal :bank_balance, :precision => 10, :scale => 2
|
|
|
|
t.decimal :big_bank_balance, :precision => 15, :scale => 2
|
|
|
|
t.decimal :world_population, :precision => 10, :scale => 0
|
|
|
|
t.decimal :my_house_population, :precision => 2, :scale => 0
|
|
|
|
t.decimal :decimal_number_with_default, :precision => 3, :scale => 2, :default => 2.78
|
2009-01-04 17:49:37 -05:00
|
|
|
t.float :temperature
|
2009-06-05 11:43:11 -04:00
|
|
|
# Oracle supports precision up to 38
|
|
|
|
if current_adapter?(:OracleAdapter)
|
|
|
|
t.decimal :atoms_in_universe, :precision => 38, :scale => 0
|
|
|
|
else
|
|
|
|
t.decimal :atoms_in_universe, :precision => 55, :scale => 0
|
|
|
|
end
|
2007-03-03 09:20:57 -05:00
|
|
|
end
|
2007-10-10 02:45:13 -04:00
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :orders, :force => true do |t|
|
|
|
|
t.string :name
|
|
|
|
t.integer :billing_customer_id
|
|
|
|
t.integer :shipping_customer_id
|
2007-10-10 02:45:13 -04:00
|
|
|
end
|
2007-10-23 02:18:42 -04:00
|
|
|
|
2008-11-15 01:59:12 -05:00
|
|
|
create_table :organizations, :force => true do |t|
|
|
|
|
t.string :name
|
|
|
|
end
|
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :owners, :primary_key => :owner_id ,:force => true do |t|
|
|
|
|
t.string :name
|
2009-04-16 18:25:55 -04:00
|
|
|
t.column :updated_at, :datetime
|
|
|
|
t.column :happy_at, :datetime
|
2007-10-27 14:51:32 -04:00
|
|
|
end
|
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
|
|
|
|
create_table :paint_colors, :force => true do |t|
|
|
|
|
t.integer :non_poly_one_id
|
2007-10-27 14:51:32 -04:00
|
|
|
end
|
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :paint_textures, :force => true do |t|
|
|
|
|
t.integer :non_poly_two_id
|
2007-10-23 02:18:42 -04:00
|
|
|
end
|
2007-10-26 01:56:46 -04:00
|
|
|
|
|
|
|
create_table :parrots, :force => true do |t|
|
|
|
|
t.column :name, :string
|
2007-11-26 17:46:11 -05:00
|
|
|
t.column :parrot_sti_class, :string
|
|
|
|
t.column :killer_id, :integer
|
2007-10-26 01:56:46 -04:00
|
|
|
t.column :created_at, :datetime
|
|
|
|
t.column :created_on, :datetime
|
|
|
|
t.column :updated_at, :datetime
|
|
|
|
t.column :updated_on, :datetime
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table :parrots_pirates, :id => false, :force => true do |t|
|
|
|
|
t.column :parrot_id, :integer
|
|
|
|
t.column :pirate_id, :integer
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table :parrots_treasures, :id => false, :force => true do |t|
|
|
|
|
t.column :parrot_id, :integer
|
|
|
|
t.column :treasure_id, :integer
|
|
|
|
end
|
2007-11-26 17:45:43 -05:00
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :people, :force => true do |t|
|
2008-12-18 20:02:21 -05:00
|
|
|
t.string :first_name, :null => false
|
|
|
|
t.references :primary_contact
|
|
|
|
t.string :gender, :limit => 1
|
2009-05-18 02:35:47 -04:00
|
|
|
t.references :number1_fan
|
2008-12-18 20:02:21 -05:00
|
|
|
t.integer :lock_version, :null => false, :default => 0
|
2007-11-25 17:08:38 -05:00
|
|
|
end
|
2007-11-26 17:45:43 -05:00
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :pets, :primary_key => :pet_id ,:force => true do |t|
|
2007-11-26 17:45:43 -05:00
|
|
|
t.string :name
|
2008-04-21 06:00:01 -04:00
|
|
|
t.integer :owner_id, :integer
|
2007-11-26 17:45:43 -05:00
|
|
|
end
|
2008-01-05 09:58:28 -05:00
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :pirates, :force => true do |t|
|
|
|
|
t.column :catchphrase, :string
|
|
|
|
t.column :parrot_id, :integer
|
|
|
|
t.column :created_on, :datetime
|
|
|
|
t.column :updated_on, :datetime
|
2008-01-05 09:58:28 -05:00
|
|
|
end
|
2008-01-31 02:50:15 -05:00
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :posts, :force => true do |t|
|
|
|
|
t.integer :author_id
|
|
|
|
t.string :title, :null => false
|
2009-03-22 17:50:05 -04:00
|
|
|
# use VARCHAR2(4000) instead of CLOB datatype as CLOB data type has many limitations in
|
|
|
|
# Oracle SELECT WHERE clause which causes many unit test failures
|
|
|
|
if current_adapter?(:OracleAdapter)
|
|
|
|
t.string :body, :null => false, :limit => 4000
|
|
|
|
else
|
|
|
|
t.text :body, :null => false
|
|
|
|
end
|
2008-04-21 06:00:01 -04:00
|
|
|
t.string :type
|
|
|
|
t.integer :comments_count, :default => 0
|
|
|
|
t.integer :taggings_count, :default => 0
|
2008-01-31 02:50:15 -05:00
|
|
|
end
|
2008-02-01 22:27:31 -05:00
|
|
|
|
|
|
|
create_table :price_estimates, :force => true do |t|
|
|
|
|
t.string :estimate_of_type
|
|
|
|
t.integer :estimate_of_id
|
|
|
|
t.integer :price
|
|
|
|
end
|
2008-03-21 19:10:42 -04:00
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :projects, :force => true do |t|
|
|
|
|
t.string :name
|
|
|
|
t.string :type
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table :readers, :force => true do |t|
|
|
|
|
t.integer :post_id, :null => false
|
|
|
|
t.integer :person_id, :null => false
|
2009-06-21 12:35:04 -04:00
|
|
|
t.boolean :skimmer, :default => false
|
2008-02-20 00:31:03 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
create_table :shape_expressions, :force => true do |t|
|
|
|
|
t.string :paint_type
|
|
|
|
t.integer :paint_id
|
|
|
|
t.string :shape_type
|
|
|
|
t.integer :shape_id
|
|
|
|
end
|
2008-03-21 19:10:42 -04:00
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :ships, :force => true do |t|
|
|
|
|
t.string :name
|
2009-01-31 20:44:30 -05:00
|
|
|
t.integer :pirate_id
|
2008-04-21 06:00:01 -04:00
|
|
|
t.datetime :created_at
|
|
|
|
t.datetime :created_on
|
|
|
|
t.datetime :updated_at
|
|
|
|
t.datetime :updated_on
|
2008-02-20 00:31:03 -05:00
|
|
|
end
|
2008-03-21 19:10:42 -04:00
|
|
|
|
2009-01-31 20:44:30 -05:00
|
|
|
create_table :ship_parts, :force => true do |t|
|
|
|
|
t.string :name
|
|
|
|
t.integer :ship_id
|
|
|
|
end
|
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :sponsors, :force => true do |t|
|
|
|
|
t.integer :club_id
|
|
|
|
t.integer :sponsorable_id
|
2009-05-11 15:01:08 -04:00
|
|
|
t.string :sponsorable_type
|
2008-02-20 00:31:03 -05:00
|
|
|
end
|
2008-03-21 19:10:42 -04:00
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :subscribers, :force => true, :id => false do |t|
|
|
|
|
t.string :nick, :null => false
|
2008-03-21 19:10:42 -04:00
|
|
|
t.string :name
|
|
|
|
end
|
2008-04-21 06:00:01 -04:00
|
|
|
add_index :subscribers, :nick, :unique => true
|
2008-03-21 19:10:42 -04:00
|
|
|
|
2008-05-01 00:30:50 -04:00
|
|
|
create_table :subscriptions, :force => true do |t|
|
|
|
|
t.string :subscriber_id
|
|
|
|
t.integer :book_id
|
|
|
|
end
|
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :tasks, :force => true do |t|
|
|
|
|
t.datetime :starting
|
|
|
|
t.datetime :ending
|
2008-03-21 19:10:42 -04:00
|
|
|
end
|
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :topics, :force => true do |t|
|
|
|
|
t.string :title
|
|
|
|
t.string :author_name
|
|
|
|
t.string :author_email_address
|
|
|
|
t.datetime :written_on
|
|
|
|
t.time :bonus_time
|
|
|
|
t.date :last_read
|
2009-03-22 17:50:05 -04:00
|
|
|
# use VARCHAR2(4000) instead of CLOB datatype as CLOB data type has many limitations in
|
|
|
|
# Oracle SELECT WHERE clause which causes many unit test failures
|
|
|
|
if current_adapter?(:OracleAdapter)
|
|
|
|
t.string :content, :limit => 4000
|
|
|
|
else
|
|
|
|
t.text :content
|
|
|
|
end
|
2008-04-21 06:00:01 -04:00
|
|
|
t.boolean :approved, :default => true
|
|
|
|
t.integer :replies_count, :default => 0
|
|
|
|
t.integer :parent_id
|
2009-07-15 16:22:25 -04:00
|
|
|
t.string :parent_title
|
2008-04-21 06:00:01 -04:00
|
|
|
t.string :type
|
2008-03-21 19:10:42 -04:00
|
|
|
end
|
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :taggings, :force => true do |t|
|
|
|
|
t.column :tag_id, :integer
|
|
|
|
t.column :super_tag_id, :integer
|
|
|
|
t.column :taggable_type, :string
|
|
|
|
t.column :taggable_id, :integer
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table :tags, :force => true do |t|
|
|
|
|
t.column :name, :string
|
|
|
|
t.column :taggings_count, :integer, :default => 0
|
|
|
|
end
|
|
|
|
|
2009-03-09 09:42:51 -04:00
|
|
|
create_table :toys, :primary_key => :toy_id ,:force => true do |t|
|
|
|
|
t.string :name
|
|
|
|
t.integer :pet_id, :integer
|
|
|
|
end
|
|
|
|
|
2009-08-04 12:03:57 -04:00
|
|
|
create_table :traffic_lights, :force => true do |t|
|
|
|
|
t.string :location
|
|
|
|
t.string :state
|
|
|
|
t.datetime :created_at
|
|
|
|
t.datetime :updated_at
|
|
|
|
end
|
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
create_table :treasures, :force => true do |t|
|
|
|
|
t.column :name, :string
|
|
|
|
t.column :looter_id, :integer
|
|
|
|
t.column :looter_type, :string
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table :vertices, :force => true do |t|
|
|
|
|
t.column :label, :string
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table 'warehouse-things', :force => true do |t|
|
|
|
|
t.integer :value
|
|
|
|
end
|
|
|
|
|
|
|
|
[:circles, :squares, :triangles, :non_poly_ones, :non_poly_twos].each do |t|
|
|
|
|
create_table(t, :force => true) { }
|
|
|
|
end
|
|
|
|
|
2008-05-04 07:28:08 -04:00
|
|
|
create_table :guids, :force => true do |t|
|
|
|
|
t.column :key, :string
|
|
|
|
end
|
|
|
|
|
2008-06-14 22:55:56 -04:00
|
|
|
create_table :integer_limits, :force => true do |t|
|
|
|
|
t.integer :"c_int_without_limit"
|
|
|
|
(1..8).each do |i|
|
|
|
|
t.integer :"c_int_#{i}", :limit => i
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2009-05-01 11:01:13 -04:00
|
|
|
# NOTE - the following 4 tables are used by models that have :inverse_of options on the associations
|
|
|
|
create_table :men, :force => true do |t|
|
|
|
|
t.string :name
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table :faces, :force => true do |t|
|
|
|
|
t.string :description
|
|
|
|
t.integer :man_id
|
2009-11-29 00:46:09 -05:00
|
|
|
t.integer :polymorphic_man_id
|
|
|
|
t.string :polymorphic_man_type
|
2009-05-01 11:01:13 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
create_table :interests, :force => true do |t|
|
|
|
|
t.string :topic
|
|
|
|
t.integer :man_id
|
2009-11-29 00:46:09 -05:00
|
|
|
t.integer :polymorphic_man_id
|
|
|
|
t.string :polymorphic_man_type
|
2009-05-01 11:01:13 -04:00
|
|
|
t.integer :zine_id
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table :zines, :force => true do |t|
|
|
|
|
t.string :title
|
|
|
|
end
|
|
|
|
|
2008-04-21 06:00:01 -04:00
|
|
|
except 'SQLite' do
|
|
|
|
# fk_test_has_fk should be before fk_test_has_pk
|
|
|
|
create_table :fk_test_has_fk, :force => true do |t|
|
|
|
|
t.integer :fk_id, :null => false
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table :fk_test_has_pk, :force => true do |t|
|
|
|
|
end
|
|
|
|
|
|
|
|
execute "ALTER TABLE fk_test_has_fk ADD CONSTRAINT fk_name FOREIGN KEY (#{quote_column_name 'fk_id'}) REFERENCES #{quote_table_name 'fk_test_has_pk'} (#{quote_column_name 'id'})"
|
2008-03-21 19:10:42 -04:00
|
|
|
end
|
2006-07-08 13:13:21 -04:00
|
|
|
end
|
2009-05-17 14:51:35 -04:00
|
|
|
|
|
|
|
Course.connection.create_table :courses, :force => true do |t|
|
|
|
|
t.column :name, :string, :null => false
|
|
|
|
end
|