Moving to github

This commit is contained in:
2026-03-28 19:24:29 -04:00
commit 036fa7ab33
302 changed files with 17838 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
class CreateUsers < ActiveRecord::Migration[8.1]
def change
create_table :users do |t|
t.string :email, null: false
t.string :username, null: false
t.string :password_digest, null: false
t.text :bio
t.boolean :profile_public, default: false, null: false
t.timestamps
end
add_index :users, :email, unique: true
add_index :users, :username, unique: true
# Enable Row Level Security
enable_rls_on :users
end
private
def enable_rls_on(table_name)
execute <<-SQL
ALTER TABLE #{table_name} ENABLE ROW LEVEL SECURITY;
CREATE POLICY #{table_name}_isolation_policy ON #{table_name}
USING (id = current_setting('app.current_user_id', true)::bigint);
SQL
end
end