Personal Table

Customizable table

To finish with the database theme, this file is customizable, but keep in mind that if you modify this table you will have to restructure the code of the other files.

In this file a table is created with the data that you will want to store of the client to follow a flow for example.

The creation is the same as the Table Chats file only with different columns which are:

const columns = [
    {name: 'id', type: 'bigserial', primaryKey: true},
    {name: 'name', type: 'text', notNull: true},
    {name: 'last_name', type: 'text', notNull: true},
    {name: 'phone_number', type: 'numeric', notNull: false},
    {name: 'language', type: 'text', notNull: true},
    {name: 'validations', type: 'boolean[]', notNull: false, define: 'ARRAY[false,false]'},
    {name: 'created_at', type: 'timestamptz', notNull: 'now()'},
]

In this same file you will also be able to modify the policies that are created automatically so that no error arises in supabase (I recommend that by default you leave it like this, you can add your policies, but avoid deleting the policies already placed).

await DatabaseManager.query(createTableQuery);
console.log("Table created successfully");

// Enable row level security basic to supabase table
const enableRLSQuery = `ALTER TABLE ${tableName} ENABLE ROW LEVEL SECURITY`;
await DatabaseManager.query(enableRLSQuery);
console.log('Row level security enabled');

Última actualización