Database Audit Trails Implementation: Add Database
To track existing tables in Hasura, navigate to the database page by selecting the database name from the sidebar. This action will display a list of all available tables in your database.
Table of Contents
Tracking Tables
You have the option to track tables selectively or all at once. By tracking tables, Hasura will introspect them and generate the corresponding GraphQL schema. This is crucial for ensuring that your API reflects the current state of your database.
!Manage my-db
Suggested Relationships
If your tables include foreign keys, Hasura will suggest relationships based on these keys. You can choose to track these relationships selectively or opt to track all of them simultaneously. This feature simplifies the process of establishing connections between your tables, enhancing the relational capabilities of your GraphQL API.
!Track tables
Adding New Tables
In the event that you do not have existing tables, you can create new ones directly within Hasura. To do this, access the Run SQL window where you can execute SQL commands against your SQL Server database. Alternatively, you can click the ‘Create Table’ button to initiate the creation of a new table.
When using raw SQL queries to create tables, ensure that you check the “track metadata” option at the bottom of the Run SQL window. This step is essential for Hasura to track your new database objects in its GraphQL schema, allowing them to be accessible through your API.
!Run SQL to create table
Read more here: Source link
