Upgraded Rails and RSpec
[monkeycharger.git] / vendor / rails / activerecord / test / fixtures / db_definitions / schema.rb
blob12dbcb842368d8ccd06c000eda864db8f78c5f23
1 ActiveRecord::Schema.define do
3   # adapter name is checked because we are under a transition of
4   # moving the sql files under activerecord/test/fixtures/db_definitions
5   # to this file, schema.rb.
6   if adapter_name == "MySQL"
7     
8     # Please keep these create table statements in alphabetical order
9     # unless the ordering matters.  In which case, define them below
10     create_table :accounts, :force => true do |t|
11       t.integer :firm_id
12       t.integer :credit_limit
13     end
15     create_table :authors, :force => true do |t|
16       t.string :name, :null => false
17     end
19     create_table :auto_id_tests, :force => true, :id => false do |t|
20       t.primary_key :auto_id
21       t.integer     :value
22     end
23     
24     create_table :binaries, :force => true do |t|
25       t.binary :data
26     end
28     create_table :booleantests, :force => true do |t|
29       t.integer :value
30     end
32     create_table :categories, :force => true do |t|
33       t.string :name, :null => false
34       t.string :type
35     end
37     create_table :categories_posts, :force => true, :id => false do |t|
38       t.integer :category_id, :null => false
39       t.integer :post_id, :null => false
40     end
42     create_table :colnametests, :force => true do |t|
43       t.integer :references, :null => false
44     end
45     
46     create_table :comments, :force => true do |t|
47       t.integer :post_id, :null => false
48       t.text    :body, :null => false
49       t.string  :type
50     end
52     create_table :companies, :force => true do |t|
53       t.string  :type
54       t.string  :ruby_type
55       t.integer :firm_id
56       t.string  :name
57       t.integer :client_of
58       t.integer :rating, :default => 1
59     end
60     
61     create_table :computers, :force => true do |t|
62       t.integer :developer, :null => false
63       t.integer :extendedWarranty, :null => false
64     end
65     
67     create_table :customers, :force => true do |t|
68       t.string  :name
69       t.integer :balance, :default => 0
70       t.string  :address_street
71       t.string  :address_city
72       t.string  :address_country
73       t.string  :gps_location
74     end
76     create_table :developers, :force => true do |t|
77       t.string   :name
78       t.integer  :salary, :default => 70000
79       t.datetime :created_at
80       t.datetime :updated_at
81     end
83     create_table :developers_projects, :force => true, :id => false do |t|
84       t.integer :developer_id, :null => false
85       t.integer :project_id, :null => false
86       t.date    :joined_on
87       t.integer :access_level, :default => 1
88     end
90     create_table :entrants, :force => true do |t|
91       t.string  :name, :null => false
92       t.integer :course_id, :null => false
93     end
95     create_table :funny_jokes, :force => true do |t|
96       t.string :name
97     end
98     
99     create_table :keyboards, :force => true, :id  => false do |t|
100       t.primary_key :key_number
101       t.string      :name
102     end
103     
104     create_table :legacy_things, :force => true do |t|
105       t.integer :tps_report_number
106       t.integer :version, :null => false, :default => 0
107     end
108     
109     create_table :minimalistics, :force => true do |t|
110     end
111     
112     create_table :mixed_case_monkeys, :force => true, :id => false do |t|
113       t.primary_key :monkeyID
114       t.integer     :fleaCount
115     end
116     
117     create_table :mixins, :force => true do |t|
118       t.integer  :parent_id
119       t.integer  :pos
120       t.datetime :created_at
121       t.datetime :updated_at
122       t.integer  :lft
123       t.integer  :rgt
124       t.integer  :root_id
125       t.string   :type
126     end
127     
128     create_table :movies, :force => true, :id => false do |t|
129       t.primary_key :movieid
130       t.string      :name
131     end
132     
133     create_table :numeric_data, :force => true do |t|
134       t.decimal :bank_balance, :precision => 10, :scale => 2
135       t.decimal :big_bank_balance, :precision => 15, :scale => 2
136       t.decimal :world_population, :precision => 10, :scale => 0
137       t.decimal :my_house_population, :precision => 2, :scale => 0
138       t.decimal :decimal_number_with_default, :precision => 3, :scale => 2, :default => 2.78
139     end
140     
141     create_table :orders, :force => true do |t|
142       t.string  :name
143       t.integer :billing_customer_id
144       t.integer :shipping_customer_id
145     end
147     create_table :people, :force => true do |t|
148       t.string  :first_name, :null => false
149       t.integer :lock_version, :null => false, :default => 0
150     end
151     
152     create_table :posts, :force => true do |t|
153       t.integer :author_id
154       t.string  :title, :null => false
155       t.text    :body, :null => false
156       t.string  :type
157     end
159     create_table :projects, :force => true do |t|
160       t.string :name
161       t.string :type
162     end
163     
164     create_table :readers, :force => true do |t|
165       t.integer :post_id, :null => false
166       t.integer :person_id, :null => false
167     end
168     
169     create_table :subscribers, :force => true, :id => false do |t|
170       t.string :nick, :null => false
171       t.string :name
172     end
173     add_index :subscribers, :nick, :unique => true
175     create_table :tasks, :force => true do |t|
176       t.datetime :starting
177       t.datetime :ending
178     end
180     create_table :topics, :force => true do |t|
181       t.string   :title
182       t.string   :author_name
183       t.string   :author_email_address
184       t.datetime :written_on
185       t.time     :bonus_time
186       t.date     :last_read
187       t.text     :content
188       t.boolean  :approved, :default => true
189       t.integer  :replies_count, :default => 0
190       t.integer  :parent_id
191       t.string   :type
192     end
196     ### These tables are created last as the order is significant
198     # fk_test_has_fk should be before fk_test_has_pk
199     create_table :fk_test_has_fk, :force => true do |t|
200       t.integer :fk_id, :null => false
201     end
203     create_table :fk_test_has_pk, :force => true do |t|
204     end
206     execute 'alter table fk_test_has_fk
207                add FOREIGN KEY (`fk_id`) REFERENCES `fk_test_has_pk`(`id`)'
210   end
212   # For Firebird, set the sequence values 10000 when create_table is called;
213   # this prevents primary key collisions between "normally" created records
214   # and fixture-based (YAML) records.
215   if adapter_name == "Firebird"
216     def create_table(*args, &block)
217       ActiveRecord::Base.connection.create_table(*args, &block)
218       ActiveRecord::Base.connection.execute "SET GENERATOR #{args.first}_seq TO 10000"
219     end
220   end
222   create_table :taggings, :force => true do |t|
223     t.column :tag_id, :integer
224     t.column :super_tag_id, :integer
225     t.column :taggable_type, :string
226     t.column :taggable_id, :integer
227   end
229   create_table :tags, :force => true do |t|
230     t.column :name, :string
231     t.column :taggings_count, :integer, :default => 0
232   end
234   create_table :categorizations, :force => true do |t|
235     t.column :category_id, :integer
236     t.column :post_id, :integer
237     t.column :author_id, :integer
238   end
240   add_column :posts, :taggings_count, :integer, :default => 0
241   add_column :authors, :author_address_id, :integer
243   create_table :author_addresses, :force => true do |t|
244     t.column :author_address_id, :integer
245   end
247   create_table :author_favorites, :force => true do |t|
248     t.column :author_id, :integer
249     t.column :favorite_author_id, :integer
250   end
252   create_table :vertices, :force => true do |t|
253     t.column :label, :string
254   end
256   create_table :edges, :force => true do |t|
257     t.column :source_id, :integer, :null => false
258     t.column :sink_id,   :integer, :null => false
259   end
260   add_index :edges, [:source_id, :sink_id], :unique => true, :name => 'unique_edge_index'
262   create_table :lock_without_defaults, :force => true do |t|
263     t.column :lock_version, :integer
264   end
265   
266   create_table :lock_without_defaults_cust, :force => true do |t|
267     t.column :custom_lock_version, :integer
268   end
269   
270   create_table :items, :force => true do |t|
271     t.column :name, :integer
272   end
274   # For sqlite 3.1.0+, make a table with a autoincrement column
275   if adapter_name == 'SQLite' and supports_autoincrement?
276     create_table :table_with_autoincrement, :force => true do |t|
277       t.column :name, :string
278     end
279   end
280   
281   # For sqlserver 2000+, ensure real columns can be used
282   if adapter_name.starts_with?("SQLServer")
283     create_table :table_with_real_columns, :force => true do |t|
284       t.column :real_number, :real
285     end
286   end
288   create_table :audit_logs, :force => true do |t|
289     t.column :message, :string, :null=>false
290     t.column :developer_id, :integer, :null=>false
291   end
293   create_table :books, :force => true do |t|
294     t.column :name, :string
295   end
297   create_table :citations, :force => true do |t|
298     t.column :book1_id, :integer
299     t.column :book2_id, :integer
300   end
302   create_table :inept_wizards, :force => true do |t|
303     t.column :name, :string, :null => false
304     t.column :city, :string, :null => false
305     t.column :type, :string
306   end
308   create_table :parrots, :force => true do |t|
309     t.column :name, :string
310     t.column :created_at, :datetime
311     t.column :created_on, :datetime
312     t.column :updated_at, :datetime
313     t.column :updated_on, :datetime
314   end
316   create_table :pirates, :force => true do |t|
317     t.column :catchphrase, :string
318     t.column :parrot_id, :integer
319     t.column :created_on, :datetime
320     t.column :updated_on, :datetime
321   end
323   create_table :parrots_pirates, :id => false, :force => true do |t|
324     t.column :parrot_id, :integer
325     t.column :pirate_id, :integer
326   end
328   create_table :treasures, :force => true do |t|
329     t.column :name, :string
330     t.column :looter_id, :integer
331     t.column :looter_type, :string
332   end
334   create_table :parrots_treasures, :id => false, :force => true do |t|
335     t.column :parrot_id, :integer
336     t.column :treasure_id, :integer
337   end