Yes. Use the updatedAtColumnName argument when instantiating the plugin.
As far as I know, you can not update an aliased table in Kysely (nor in Postgres)
Yes. Use the deletedAtColumnName argument when instantiating the plugin.
Yes, as long as if you don't alias a table that is part of ignoredTables. In that specific case, if the alias
itself is not in ignoredTables, the referenced column (e.g. "deleted_at") will be checked.
NO!! To soft delete, update the referenced column (e.g. "deleted_at") with an .updateTable(...).
.deleteFrom(...) still does a hard delete.
It's up to you to decide to forbid .deleteFrom(...) with your linter or not.
Here's a basic example of how to do it in your tsconfig.json (you probably need to change the object.name value).
{
// ...
"rules": {
"no-restricted-syntax": [
"error",
{
"selector": "MemberExpression[object.name=db][property.name='deleteFrom']",
"message": "Hard delete are not allowed"
}
]
}
}Yes. No other database have been tested yet.
Yes
Yes
Yes. Make sure the CamelCasePlugin comes before those plugins when instantiating Kysely.
No, it's up to you to check it.
Yes. Use the ignoredTables argument when instantiating the plugin. Kysely tables are always ignored.
export const db = new Kysely<DB>({
// ...
plugins:
[
new SoftDelete({ ignoredTables: ["no_updated_at_here", "i_aint_got_any_updated_at"] }),
new AutoUpdatedAt({ ignoredTables: ["dont_soft_delete_me_please"] }),
],
});Is any code? We use this code in production at my company.