aboutsummaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
authorMarc Florisson2012-08-30 16:29:57 +0200
committerMarc Florisson2012-08-30 16:29:57 +0200
commit1738789aebd17c0758d9757b1708f20b20ce8c7e (patch)
treef760ba154b6a228c94cbd21d08d42dee5206bede /db
parent1022647089b7044c2fac02133f33d7be79457500 (diff)
parent2dca376725013ac504649c4f2371353d1ad9e8ef (diff)
downloadchouette-core-1738789aebd17c0758d9757b1708f20b20ce8c7e.tar.bz2
merge
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20120823053740_create_organisation.rb24
-rw-r--r--db/migrate/20120824094751_add_name_to_user.rb7
-rw-r--r--db/migrate/20120830092409_add_encrypt_confirm_lock_token_to_user.rb23
-rw-r--r--db/migrate/20120830095442_add_invitable_to_user.rb18
4 files changed, 72 insertions, 0 deletions
diff --git a/db/migrate/20120823053740_create_organisation.rb b/db/migrate/20120823053740_create_organisation.rb
new file mode 100644
index 000000000..d3778f057
--- /dev/null
+++ b/db/migrate/20120823053740_create_organisation.rb
@@ -0,0 +1,24 @@
+class CreateOrganisation < ActiveRecord::Migration
+ def up
+ create_table :organisations do |t|
+ t.string :name
+ t.timestamps
+ end
+ change_table :referentials do |n|
+ n.belongs_to :organisation
+ end
+ change_table :users do |u|
+ u.belongs_to :organisation
+ end
+ Referential.reset_column_information
+ User.reset_column_information
+
+ organisation = Organisation.create! :name => "Chouette"
+ Referential.update_all :organisation_id => organisation.id
+ User.update_all :organisation_id => organisation.id
+ end
+
+ def down
+ drop_table :organisations
+ end
+end
diff --git a/db/migrate/20120824094751_add_name_to_user.rb b/db/migrate/20120824094751_add_name_to_user.rb
new file mode 100644
index 000000000..6822e4d6e
--- /dev/null
+++ b/db/migrate/20120824094751_add_name_to_user.rb
@@ -0,0 +1,7 @@
+class AddNameToUser < ActiveRecord::Migration
+ def change
+ change_table :users do |t|
+ t.string :name
+ end
+ end
+end
diff --git a/db/migrate/20120830092409_add_encrypt_confirm_lock_token_to_user.rb b/db/migrate/20120830092409_add_encrypt_confirm_lock_token_to_user.rb
new file mode 100644
index 000000000..23425959e
--- /dev/null
+++ b/db/migrate/20120830092409_add_encrypt_confirm_lock_token_to_user.rb
@@ -0,0 +1,23 @@
+class AddEncryptConfirmLockTokenToUser < ActiveRecord::Migration
+ def change
+ change_table :users do |t|
+ ## Encryptable
+ # t.string :password_salt
+
+ ## Confirmable
+ t.string :confirmation_token
+ t.datetime :confirmed_at
+ t.datetime :confirmation_sent_at
+ t.string :unconfirmed_email # Only if using reconfirmable
+
+ ## Lockable
+ t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
+ t.string :unlock_token # Only if unlock strategy is :email or :both
+ t.datetime :locked_at
+
+ ## Token authenticatable
+ t.string :authentication_token
+ end
+
+ end
+end
diff --git a/db/migrate/20120830095442_add_invitable_to_user.rb b/db/migrate/20120830095442_add_invitable_to_user.rb
new file mode 100644
index 000000000..33720cb95
--- /dev/null
+++ b/db/migrate/20120830095442_add_invitable_to_user.rb
@@ -0,0 +1,18 @@
+class AddInvitableToUser < ActiveRecord::Migration
+ def change
+ change_table :users do |t|
+ t.string :invitation_token, :limit => 60
+ t.datetime :invitation_sent_at
+ t.datetime :invitation_accepted_at
+ t.integer :invitation_limit
+ t.integer :invited_by_id
+ t.string :invited_by_type
+
+ end
+
+ # Allow null encrypted_password
+ change_column :users, :encrypted_password, :string, :null => true
+ # Allow null password_salt (add it if you are using Devise's encryptable module)
+ change_column :users, :password_salt, :string, :null => true
+ end
+end