create org model and schema manager
This commit is contained in:
21
db/migrate/20250611160914_create_organizations.rb
Normal file
21
db/migrate/20250611160914_create_organizations.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
class CreateOrganizations < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
# Enable pgcrypto extension for UUID support
|
||||
enable_extension 'pgcrypto' if connection.adapter_name == 'PostgreSQL'
|
||||
|
||||
create_table :organizations, id: :uuid do |t|
|
||||
t.string :name
|
||||
t.string :subdomain
|
||||
t.string :email_domain
|
||||
t.string :logo_url
|
||||
t.string :address
|
||||
t.string :website
|
||||
t.string :phone_number
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :organizations, :subdomain, unique: true
|
||||
add_reference :users, :organization, null: false, foreign_key: true, type: :uuid
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user