-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add two billing migrations * Fix name colummn
- Loading branch information
1 parent
0e32a0a
commit 4fa8927
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
src/db/migrations/20240311145834_delete_some_billing_columns.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import {Knex} from 'knex'; | ||
|
||
export async function up(knex: Knex): Promise<void> { | ||
return knex.raw(` | ||
ALTER TABLE tenants DROP COLUMN billing_account_id; | ||
ALTER TABLE tenants DROP COLUMN billing_rate; | ||
DROP TYPE BILLING_RATE_TYPE; | ||
`); | ||
} | ||
|
||
export async function down(knex: Knex): Promise<void> { | ||
return knex.raw(` | ||
CREATE TYPE BILLING_RATE_TYPE AS ENUM ('community', 'business'); | ||
ALTER TABLE tenants ADD COLUMN billing_rate BILLING_RATE_TYPE NOT NULL DEFAULT('community'); | ||
ALTER TABLE tenants ADD COLUMN billing_account_id VARCHAR(255) DEFAULT NULL; | ||
`); | ||
} |
25 changes: 25 additions & 0 deletions
25
src/db/migrations/20240311150016_add_new_billing_columns.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import {Knex} from 'knex'; | ||
|
||
export async function up(knex: Knex): Promise<void> { | ||
return knex.raw(` | ||
ALTER TABLE tenants | ||
ADD COLUMN billing_paused_by_user BOOLEAN NOT NULL DEFAULT FALSE; | ||
ALTER TABLE tenants | ||
ADD COLUMN billing_instance_service_is_active BOOLEAN NOT NULL DEFAULT FALSE; | ||
ALTER TABLE tenants ADD COLUMN billing_ended_at TIMESTAMPTZ DEFAULT NULL; | ||
`); | ||
} | ||
|
||
export async function down(knex: Knex): Promise<void> { | ||
return knex.raw(` | ||
ALTER TABLE tenants DROP COLUMN billing_ended_at; | ||
ALTER TABLE tenants | ||
DROP COLUMN billing_instance_service_is_active; | ||
ALTER TABLE tenants | ||
DROP COLUMN billing_paused_by_user; | ||
`); | ||
} |