mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 12:04:08 +00:00
Initial commit
This commit is contained in:
5
db/migrate/20240201183314_enable_uuid.rb
Normal file
5
db/migrate/20240201183314_enable_uuid.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class EnableUuid < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
enable_extension 'pgcrypto' unless extension_enabled?('pgcrypto')
|
||||
end
|
||||
end
|
||||
9
db/migrate/20240201184038_create_families.rb
Normal file
9
db/migrate/20240201184038_create_families.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
class CreateFamilies < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
create_table :families, id: :uuid do |t|
|
||||
t.string :name
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
13
db/migrate/20240201184212_create_users.rb
Normal file
13
db/migrate/20240201184212_create_users.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
class CreateUsers < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
create_table :users, id: :uuid do |t|
|
||||
t.references :family, null: false, foreign_key: true, type: :uuid
|
||||
t.string :first_name
|
||||
t.string :last_name
|
||||
t.string :email
|
||||
t.string :password_digest
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
16
db/migrate/20240202015428_create_accounts.rb
Normal file
16
db/migrate/20240202015428_create_accounts.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
class CreateAccounts < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
create_table :accounts, id: :uuid do |t|
|
||||
t.string :type
|
||||
t.string :subtype
|
||||
t.references :family, null: false, foreign_key: true, type: :uuid
|
||||
t.string :name
|
||||
t.bigint :balance, default: 0
|
||||
t.string :currency, default: "USD"
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :accounts, :type
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user