feat: enable soft delete for organizations (#16584)

- Add deleted column to organizations table
- Add trigger to check for existing workspaces, templates, groups and
members in a org before allowing the soft delete

---------

Co-authored-by: Steven Masley <stevenmasley@gmail.com>
Co-authored-by: Steven Masley <Emyrk@users.noreply.github.com>
This commit is contained in:
Jaayden Halko
2025-02-24 12:59:41 -05:00
committed by GitHub
co-authored by Steven Masley Steven Masley
parent dfa33b11d9
commit 546a549dcf
28 changed files with 605 additions and 215 deletions
+3 -3
View File
@@ -159,17 +159,17 @@ Database migrations are managed with
To add new migrations, use the following command:
```shell
./coderd/database/migrations/create_fixture.sh my name
./coderd/database/migrations/create_migration.sh my name
/home/coder/src/coder/coderd/database/migrations/000070_my_name.up.sql
/home/coder/src/coder/coderd/database/migrations/000070_my_name.down.sql
```
Run "make gen" to generate models.
Then write queries into the generated `.up.sql` and `.down.sql` files and commit
them into the repository. The down script should make a best-effort to retain as
much data as possible.
Run `make gen` to generate models.
#### Database fixtures (for testing migrations)
There are two types of fixtures that are used to test that migrations don't