Kwil Introduces Foreign Key Support and Error Functions to Its Decentralised Databases
Kwil, the team building decentralised Web3 databases, have just announced the addition of two new features: Foreign Key support and Error functions. These features have been frequently requested and will deliver increased control over data integrity and error handling within the Kwil ecosystem.
Talking to Luke Lamey, Co-Founder at Kwil, Permaweb News found out that Kwil has many new updates on the way.
Over the past few months, our team has focused on stabilizing and enhancing the user experience on Kwil. This has involved overhauling our documentation, releasing an officially supported SQL syntax, and as of recently, an intuitive database explorer. The database explorer simplifies the complex nature of relational databases and their interactions with end users.
Our team views these developments as significant stepping stones toward making decentralized database management more intuitive and accessible than ever before. We're already gearing up for a series of groundbreaking features slated for release in the coming months, which will further advance the capabilities of Kwil and the products being built on top of it - Luke Lamey, Co-Founder, Operations at Kwil
Let's take a look at the latest.
Foreign Key Support
Foreign Keys are fundamental elements in database systems. They are used to link two tables together, enforcing rules on relationships between columns in different tables. The addition of this feature to Kwil's decentralised databases will enable developers to design and manage more complex data relationships with ease.
With the new update, developers can now add a foreign key declaration within their table declarations. This links a column in the declared table to a column in another table, providing the functionality to enforce uniqueness across referenced columns.
Additionally, developers can optionally set an operation to be executed when the linked column is updated or deleted. The following operations are available:
No_action: No operation is triggered.
Restrict: The column cannot be updated.
Set_null: The column is set to null.
Set_default: The column is set to the column's default value (if specified in the table declaration).
Cascade: The change in the reference column cascades to the specified column. In the case of a deletion, it will delete the entire record.
Kwil is also introducing a new function called ERROR(). This function can be used to halt an action if a certain logic condition is met. This is particularly useful for Web3 apps, where developers often need to restrict data access based on specific conditions.
For instance, ERROR() can be used to prevent actions based on a user's balance. If a user's balance does not meet the required threshold, the ERROR() function can be invoked to halt further action, adding an additional layer of security and logic to the application's operation.