Imrpove migrations
This commit is contained in:
1 parent
49b53451b7
commit
137e53618b
3 files changed
+14
-5
No files matched your search
@@ -35,7 +35,8 @@ Sequel.migration do
|
|||||||
create_table(:account_password_hashes) do
|
create_table(:account_password_hashes) do
|
||||||
foreign_key :id, :accounts,
|
foreign_key :id, :accounts,
|
||||||
primary_key: true,
|
primary_key: true,
|
||||||
type: :Bignum
|
type: :Bignum,
|
||||||
|
on_delete: :cascade
|
||||||
|
|
||||||
String :password_hash, null: false
|
String :password_hash, null: false
|
||||||
end
|
end
|
||||||
@@ -43,7 +44,8 @@ Sequel.migration do
|
|||||||
create_table(:account_verification_keys) do
|
create_table(:account_verification_keys) do
|
||||||
foreign_key :id, :accounts,
|
foreign_key :id, :accounts,
|
||||||
primary_key: true,
|
primary_key: true,
|
||||||
type: :Bignum
|
type: :Bignum,
|
||||||
|
on_delete: :cascade
|
||||||
|
|
||||||
String :key, null: false
|
String :key, null: false
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ Sequel.migration do
|
|||||||
|
|
||||||
foreign_key :account_id, :accounts,
|
foreign_key :account_id, :accounts,
|
||||||
type: :Bignum,
|
type: :Bignum,
|
||||||
null: false
|
null: false,
|
||||||
|
on_delete: :cascade
|
||||||
|
|
||||||
String :kind, null: false
|
String :kind, null: false
|
||||||
String :first_name
|
String :first_name
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ Sequel.migration do
|
|||||||
|
|
||||||
foreign_key :member_id, :members,
|
foreign_key :member_id, :members,
|
||||||
type: :Bignum,
|
type: :Bignum,
|
||||||
null: false
|
null: false,
|
||||||
|
on_delete: :cascade
|
||||||
|
|
||||||
String :status, null: false, default: "pending"
|
String :status, null: false, default: "pending"
|
||||||
|
|
||||||
@@ -16,13 +17,18 @@ Sequel.migration do
|
|||||||
DateTime :decided_at
|
DateTime :decided_at
|
||||||
|
|
||||||
foreign_key :recorded_by, :members,
|
foreign_key :recorded_by, :members,
|
||||||
type: :Bignum
|
type: :Bignum,
|
||||||
|
null: true,
|
||||||
|
on_delete: :set_null
|
||||||
|
|
||||||
|
index :member_id, name: :memberships_member_id_all_index
|
||||||
|
index :recorded_by
|
||||||
index :status
|
index :status
|
||||||
|
|
||||||
# Un seul dossier en attente ou une seule adhésion acceptée.
|
# Un seul dossier en attente ou une seule adhésion acceptée.
|
||||||
index :member_id,
|
index :member_id,
|
||||||
unique: true,
|
unique: true,
|
||||||
|
name: :memberships_active_member_id_index,
|
||||||
where: { status: ["pending", "accepted"] }
|
where: { status: ["pending", "accepted"] }
|
||||||
|
|
||||||
constraint :memberships_status_valid,
|
constraint :memberships_status_valid,
|
||||||
|
|||||||
Reference in new issue
Block a user