Databasebeginner
Create a Database Table With Access Rules
Creates a table and its security policies in one step, so you never end up with a table nobody can query.
When to use it
Data modelling
Lovable Prompt
Create a [TABLE NAME] table. Columns: - [column] — [type] — [required or optional] — [default] - (repeat for each column) - A reference to the owning user - A created timestamp Rules: - Enable row level security and grant the correct table privileges in the same migration. - Signed-in users can read, insert, update and delete only their own rows. - Admins can manage all rows using the existing role-check function. - Add an index on every column I will filter or sort by. After creating it, show me a simple screen that lists my rows and lets me add one, with empty, loading and error states.
Why it works
It bundles the four things that must happen together — table, privileges, policies, indexes — so none of them is forgotten.