mirror of
https://github.com/ryankazokas/turbovault-app.git
synced 2026-04-16 23:22:53 +00:00
Adds types
This commit is contained in:
@@ -21,7 +21,7 @@ class CreateUsers < ActiveRecord::Migration[8.1]
|
||||
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
|
||||
|
||||
@@ -14,7 +14,7 @@ class CreateApiTokens < ActiveRecord::Migration[8.1]
|
||||
# Enable Row Level Security
|
||||
execute <<-SQL
|
||||
ALTER TABLE api_tokens ENABLE ROW LEVEL SECURITY;
|
||||
|
||||
|
||||
CREATE POLICY api_tokens_isolation_policy ON api_tokens
|
||||
USING (user_id = current_setting('app.current_user_id', true)::bigint);
|
||||
SQL
|
||||
|
||||
@@ -25,7 +25,7 @@ class CreateGames < ActiveRecord::Migration[8.1]
|
||||
# Enable Row Level Security
|
||||
execute <<-SQL
|
||||
ALTER TABLE games ENABLE ROW LEVEL SECURITY;
|
||||
|
||||
|
||||
CREATE POLICY games_isolation_policy ON games
|
||||
USING (user_id = current_setting('app.current_user_id', true)::bigint);
|
||||
SQL
|
||||
|
||||
@@ -15,7 +15,7 @@ class CreateCollections < ActiveRecord::Migration[8.1]
|
||||
# Enable Row Level Security
|
||||
execute <<-SQL
|
||||
ALTER TABLE collections ENABLE ROW LEVEL SECURITY;
|
||||
|
||||
|
||||
CREATE POLICY collections_isolation_policy ON collections
|
||||
USING (user_id = current_setting('app.current_user_id', true)::bigint);
|
||||
SQL
|
||||
|
||||
@@ -20,7 +20,7 @@ class CreateItems < ActiveRecord::Migration[8.1]
|
||||
# Enable Row Level Security
|
||||
execute <<-SQL
|
||||
ALTER TABLE items ENABLE ROW LEVEL SECURITY;
|
||||
|
||||
|
||||
CREATE POLICY items_isolation_policy ON items
|
||||
USING (user_id = current_setting('app.current_user_id', true)::bigint);
|
||||
SQL
|
||||
|
||||
Reference in New Issue
Block a user