Grosse MàJ
This commit is contained in:
19
P5B/ruby/mon_projet/db/migrate/001_create_products.rb
Normal file
19
P5B/ruby/mon_projet/db/migrate/001_create_products.rb
Normal file
@ -0,0 +1,19 @@
|
||||
class CreateProducts < ActiveRecord::Migration
|
||||
def self.up
|
||||
db_name = ActiveRecord::Base::connection.current_database()
|
||||
execute "ALTER DATABASE #{db_name} CHARACTER SET utf8 COLLATE utf8_general_ci"
|
||||
|
||||
create_table :products do |t|
|
||||
t.column :designation, :string
|
||||
t.column :description, :text
|
||||
t.column :created_at, :datetime
|
||||
t.column :updated_at, :datetime
|
||||
t.column :supplier_id, :int
|
||||
t.column :customer_id, :int
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :products
|
||||
end
|
||||
end
|
18
P5B/ruby/mon_projet/db/migrate/001_create_products.rb~
Normal file
18
P5B/ruby/mon_projet/db/migrate/001_create_products.rb~
Normal file
@ -0,0 +1,18 @@
|
||||
class CreateProducts < ActiveRecord::Migration
|
||||
def self.up
|
||||
db_name = ActiveRecord::Base::connection.current_database()
|
||||
execute "ALTER DATABASE #{db_name} CHARACTER SET utf8 COLLATE utf8_general_ci"
|
||||
|
||||
create_table :products do |t|
|
||||
t.column :designation, :string
|
||||
t.column :description, :text
|
||||
t.column :created_at, :datetime
|
||||
t.column :updated_at, :datetime
|
||||
t.column :supplier_id, :int
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :products
|
||||
end
|
||||
end
|
18
P5B/ruby/mon_projet/db/migrate/002_create_suppliers.rb
Normal file
18
P5B/ruby/mon_projet/db/migrate/002_create_suppliers.rb
Normal file
@ -0,0 +1,18 @@
|
||||
class CreateSuppliers < ActiveRecord::Migration
|
||||
def self.up
|
||||
db_name = ActiveRecord::Base::connection.current_database()
|
||||
execute "ALTER DATABASE #{db_name} CHARACTER SET utf8 COLLATE utf8_general_ci"
|
||||
|
||||
create_table :suppliers do |t|
|
||||
t.column :name, :string
|
||||
t.column :description, :text
|
||||
t.column :code, :string
|
||||
t.column :created_at, :datetime
|
||||
t.column :updated_at, :datetime
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :suppliers
|
||||
end
|
||||
end
|
19
P5B/ruby/mon_projet/db/migrate/002_create_suppliers.rb~
Normal file
19
P5B/ruby/mon_projet/db/migrate/002_create_suppliers.rb~
Normal file
@ -0,0 +1,19 @@
|
||||
class CreateSuppliers < ActiveRecord::Migration
|
||||
has_many :products
|
||||
def self.up
|
||||
db_name = ActiveRecord::Base::connection.current_database()
|
||||
execute "ALTER DATABASE #{db_name} CHARACTER SET utf8 COLLATE utf8_general_ci"
|
||||
|
||||
create_table :suppliers do |t|
|
||||
t.column :name, :string
|
||||
t.column :description, :text
|
||||
t.column :code, :string
|
||||
t.column :created_at, :datetime
|
||||
t.column :updated_at, :datetime
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :suppliers
|
||||
end
|
||||
end
|
15
P5B/ruby/mon_projet/db/migrate/003_create_customers.rb
Normal file
15
P5B/ruby/mon_projet/db/migrate/003_create_customers.rb
Normal file
@ -0,0 +1,15 @@
|
||||
class CreateCustomers < ActiveRecord::Migration
|
||||
def self.up
|
||||
db_name = ActiveRecord::Base::connection.current_database()
|
||||
execute "ALTER DATABASE #{db_name} CHARACTER SET utf8 COLLATE utf8_general_ci"
|
||||
|
||||
create_table :customers do |t|
|
||||
t.column :firstname, :string
|
||||
t.column :name, :string
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :customers
|
||||
end
|
||||
end
|
12
P5B/ruby/mon_projet/db/migrate/003_create_customers.rb~
Normal file
12
P5B/ruby/mon_projet/db/migrate/003_create_customers.rb~
Normal file
@ -0,0 +1,12 @@
|
||||
class CreateCustomers < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :customers do |t|
|
||||
t.column :firstname, :string
|
||||
t.column :name, :string
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :customers
|
||||
end
|
||||
end
|
17
P5B/ruby/mon_projet/db/migrate/004_create_addresses.rb
Normal file
17
P5B/ruby/mon_projet/db/migrate/004_create_addresses.rb
Normal file
@ -0,0 +1,17 @@
|
||||
class CreateAddresses < ActiveRecord::Migration
|
||||
def self.up
|
||||
db_name = ActiveRecord::Base::connection.current_database()
|
||||
execute "ALTER DATABASE #{db_name} CHARACTER SET utf8 COLLATE utf8_general_ci"
|
||||
|
||||
create_table :addresses do |t|
|
||||
t.column :street, :text
|
||||
t.column :postal_code, :string
|
||||
t.column :city, :string
|
||||
t.column :country, :string
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :addresses
|
||||
end
|
||||
end
|
14
P5B/ruby/mon_projet/db/migrate/004_create_addresses.rb~
Normal file
14
P5B/ruby/mon_projet/db/migrate/004_create_addresses.rb~
Normal file
@ -0,0 +1,14 @@
|
||||
class CreateAddresses < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :addresses do |t|
|
||||
t.column :street, :text
|
||||
t.column :postal_code, :string
|
||||
t.column :city, :string
|
||||
t.column :country, :string
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :addresses
|
||||
end
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
class AddTypeToProducts < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :products, :type, :string
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :products, :type
|
||||
end
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
class AddTypeToProducts < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :products; :type, :string
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :products, :type
|
||||
end
|
||||
end
|
21
P5B/ruby/mon_projet/db/migrate/006_create_utilisateurs.rb
Normal file
21
P5B/ruby/mon_projet/db/migrate/006_create_utilisateurs.rb
Normal file
@ -0,0 +1,21 @@
|
||||
class CreateUtilisateurs < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table "utilisateurs", :force => true do |t|
|
||||
t.column :login, :string
|
||||
t.column :email, :string
|
||||
t.column :crypted_password, :string, :limit => 40
|
||||
t.column :salt, :string, :limit => 40
|
||||
t.column :created_at, :datetime
|
||||
t.column :updated_at, :datetime
|
||||
t.column :remember_token, :string
|
||||
t.column :remember_token_expires_at, :datetime
|
||||
|
||||
t.column :activation_code, :string, :limit => 40
|
||||
t.column :activated_at, :datetime
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table "utilisateurs"
|
||||
end
|
||||
end
|
50
P5B/ruby/mon_projet/db/schema.rb
Normal file
50
P5B/ruby/mon_projet/db/schema.rb
Normal file
@ -0,0 +1,50 @@
|
||||
# This file is autogenerated. Instead of editing this file, please use the
|
||||
# migrations feature of ActiveRecord to incrementally modify your database, and
|
||||
# then regenerate this schema definition.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 6) do
|
||||
|
||||
create_table "addresses", :force => true do |t|
|
||||
t.column "street", :text
|
||||
t.column "postal_code", :string
|
||||
t.column "city", :string
|
||||
t.column "country", :string
|
||||
end
|
||||
|
||||
create_table "customers", :force => true do |t|
|
||||
t.column "firstname", :string
|
||||
t.column "name", :string
|
||||
end
|
||||
|
||||
create_table "products", :force => true do |t|
|
||||
t.column "designation", :string
|
||||
t.column "description", :text
|
||||
t.column "created_at", :datetime
|
||||
t.column "updated_at", :datetime
|
||||
t.column "supplier_id", :integer
|
||||
t.column "customer_id", :integer
|
||||
t.column "type", :string
|
||||
end
|
||||
|
||||
create_table "suppliers", :force => true do |t|
|
||||
t.column "name", :string
|
||||
t.column "description", :text
|
||||
t.column "code", :string
|
||||
t.column "created_at", :datetime
|
||||
t.column "updated_at", :datetime
|
||||
end
|
||||
|
||||
create_table "utilisateurs", :force => true do |t|
|
||||
t.column "login", :string
|
||||
t.column "email", :string
|
||||
t.column "crypted_password", :string, :limit => 40
|
||||
t.column "salt", :string, :limit => 40
|
||||
t.column "created_at", :datetime
|
||||
t.column "updated_at", :datetime
|
||||
t.column "remember_token", :string
|
||||
t.column "remember_token_expires_at", :datetime
|
||||
t.column "activation_code", :string, :limit => 40
|
||||
t.column "activated_at", :datetime
|
||||
end
|
||||
|
||||
end
|
Reference in New Issue
Block a user