@vrplatform/kysely 1.3.45-41438724917 → 1.3.45-41814881028
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Kysely } from 'kysely';
|
|
2
|
+
import { sql } from 'kysely';
|
|
3
|
+
|
|
4
|
+
// VRT-805: adds the equity and costOfRevenue classifications and the new
|
|
5
|
+
// categories whose names are free before the renames. The rows use a
|
|
6
|
+
// classification the old code parses; `scripts/fix/vrt-805-chart-of-accounts.ts`
|
|
7
|
+
// renames, re-classifies and creates the new Cost of Revenue - Rents once the
|
|
8
|
+
// new code runs.
|
|
9
|
+
export async function up(db: Kysely<unknown>): Promise<void> {
|
|
10
|
+
await sql`
|
|
11
|
+
insert into accounting.account_classification (name)
|
|
12
|
+
values ('equity'), ('costOfRevenue')
|
|
13
|
+
on conflict (name) do nothing
|
|
14
|
+
`.execute(db);
|
|
15
|
+
|
|
16
|
+
await sql`
|
|
17
|
+
insert into accounting.account_category (id, name, classification, "index")
|
|
18
|
+
values
|
|
19
|
+
('7ee6de3d-271d-431b-bac8-80cdfd64f342'::uuid, 'Revenue - Guests: Taxes Collected', 'revenue', 53),
|
|
20
|
+
('fc0679d1-84f6-40a1-94f7-e9f4e0fd6aa5'::uuid, 'Revenue - Management: VAT', 'revenue', 57),
|
|
21
|
+
('dce650ed-a3d7-4ba5-9c2c-fa99d4badfc7'::uuid, 'Cost of Revenue - Owner Deductions', 'expense', 67),
|
|
22
|
+
('b182f0f2-82b7-41db-8681-f94b2d4a5b8a'::uuid, 'Cost of Revenue - VAT', 'expense', 68),
|
|
23
|
+
('a3aeab43-9347-4734-bad3-96e4305dd27d'::uuid, 'Transfers', 'expense', 101),
|
|
24
|
+
('e1534965-2e01-4bc5-bdf8-a6342980f0ca'::uuid, 'Adjustments', 'expense', 102)
|
|
25
|
+
on conflict (id) do nothing
|
|
26
|
+
`.execute(db);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export async function down(db: Kysely<unknown>): Promise<void> {
|
|
30
|
+
await sql`
|
|
31
|
+
delete from accounting.account_category
|
|
32
|
+
where id in (
|
|
33
|
+
'7ee6de3d-271d-431b-bac8-80cdfd64f342'::uuid,
|
|
34
|
+
'fc0679d1-84f6-40a1-94f7-e9f4e0fd6aa5'::uuid,
|
|
35
|
+
'dce650ed-a3d7-4ba5-9c2c-fa99d4badfc7'::uuid,
|
|
36
|
+
'b182f0f2-82b7-41db-8681-f94b2d4a5b8a'::uuid,
|
|
37
|
+
'a3aeab43-9347-4734-bad3-96e4305dd27d'::uuid,
|
|
38
|
+
'e1534965-2e01-4bc5-bdf8-a6342980f0ca'::uuid
|
|
39
|
+
)
|
|
40
|
+
`.execute(db);
|
|
41
|
+
|
|
42
|
+
await sql`
|
|
43
|
+
delete from accounting.account_classification
|
|
44
|
+
where name in ('equity', 'costOfRevenue')
|
|
45
|
+
`.execute(db);
|
|
46
|
+
}
|