create org model and schema manager

This commit is contained in:
2025-06-11 18:23:16 +02:00
parent 16b27a0d1c
commit 8be82f5c49
7 changed files with 144 additions and 0 deletions

View 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