Skip to content

Commit 121feec

Browse files
committed
Merge branch 'fix-custom-scripts'
2 parents 2f549ac + 855d7f4 commit 121feec

File tree

5 files changed

+47
-52
lines changed

5 files changed

+47
-52
lines changed

custom/al.sql

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
--albania oct 2025 - jan 2026
2+
--albania oct 2025 - jan 2026 mar 2026
33

44
\ir ./reset.sql
55

@@ -12,36 +12,31 @@ BEGIN
1212
--CALL public.custom_setup_reset();
1313
--utkommenterer reset ettersom den ikkke finnes..
1414
--select * from external_ident_type
15-
15+
1616

1717
--al no need for stat ident
1818
UPDATE external_ident_type
19-
SET archived = TRUE
19+
SET enabled = FALSE
2020
WHERE id = 2;
2121

2222

23-
24-
25-
2623
INSERT INTO data_source_custom (code, name)
2724
VALUES
2825
('tax', 'Tax');
2926

30-
--no more default active passive
27+
--no more default active / passive
3128
update status
32-
set active = FALSE
29+
set enabled = FALSE
3330
where id =1 or id = 2;
3431

3532

3633
INSERT INTO status
37-
(code, name, assigned_by_default, used_for_counting, priority, active, custom)
34+
(code, name, assigned_by_default, used_for_counting, priority, enabled, custom)
3835
VALUES
39-
('1', 'Active', TRUE, TRUE, 3, TRUE, TRUE),
40-
('2', 'Closed', FALSE, FALSE, 6, TRUE, TRUE),
36+
('1', 'Active', TRUE, TRUE, 3, TRUE, TRUE),
37+
('2', 'Closed', FALSE, FALSE, 6, TRUE, TRUE),
4138
('3', 'Passive', FALSE, FALSE, 4, TRUE, TRUE),
42-
('4', 'Never_Active', FALSE, FALSE, 5, TRUE, TRUE);
43-
44-
39+
('4', 'Never_Active', FALSE, FALSE, 5, TRUE, TRUE);
4540

4641

4742

@@ -55,13 +50,11 @@ where id = 2 ; -- nace
5550

5651

5752

58-
59-
6053
INSERT INTO stat_definition (code, type, frequency, name, priority)
6154
VALUES
6255
('female', 'int', 'yearly', 'Female', 3),
6356
('male', 'int', 'yearly', 'Male', 4),
64-
('selfemp', 'int', 'yearly', 'SelfEmp', 5),
57+
('selfemp', 'int', 'yearly', 'SelfEmp', 5),
6558
('punpag', 'int', 'yearly', 'PunPag', 6);
6659

6760
RAISE NOTICE 'Done Tirana Albania at %', now();

custom/jo.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ AS $BODY$
99
BEGIN
1010

1111
RAISE NOTICE 'Runs JO at %', now();
12-
CALL public.custom_setup_reset();
12+
--CALL public.custom_setup_reset();
1313

1414
-- Before running this procedure you may need to
1515
-- reset units and classifications in Statbus (Ctrl+Shift+K)
1616
-- This customization must be completed BEFORE loading legal/establishment units.
1717

1818

1919
UPDATE status
20-
SET active = TRUE;
20+
SET enabled = TRUE;
2121

2222
-- If Jordan has custom statuses, they can be inserted here later
2323

@@ -29,7 +29,7 @@ BEGIN
2929

3030
-- Archive default ones not needed
3131
UPDATE external_ident_type
32-
SET archived = TRUE
32+
SET enabled = FALSE
3333
WHERE id <= 2;
3434

3535

custom/ke.sql

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
--Erik
2+
--Erik
33

44

55
\ir ./reset.sql
@@ -11,41 +11,41 @@ AS $BODY$
1111
BEGIN
1212

1313
RAISE NOTICE 'Runs KE at %', now();
14-
CALL public.custom_setup_reset();
14+
--CALL public.custom_setup_reset();
1515

1616

1717
INSERT INTO external_ident_type (code, name, priority)
1818
VALUES
1919
('krapin', 'KRAPin', 3),
2020
('brs', 'BRS', 4),
2121
('nssf', 'NSSF', 5),
22-
('sbp', 'SBP', 6),
22+
('sbp', 'SBP', 6),
2323
('nhif', 'NHIF', 7);
24-
24+
2525
--tbc wont need any of the originals in KE
2626
--hiding tax_ident and stat_ident --this is a problem ??
2727
UPDATE external_ident_type
28-
SET archived = TRUE
28+
SET enabled = FALSE
2929
WHERE id <= 2;
3030

3131

3232

3333

3434
INSERT INTO data_source_custom (code, name)
3535
VALUES
36-
('tax', 'Tax'),
36+
('tax', 'Tax'),
3737
('test', 'Test');
3838

3939
UPDATE data_source
40-
SET active = TRUE;
40+
SET enabled = TRUE;
4141

4242

4343
INSERT INTO stat_definition (code, type, frequency, name, priority)
4444
VALUES
45-
('female', 'int', 'yearly', 'Female', 3),
46-
('male', 'int', 'yearly', 'Male', 4),
47-
('production', 'float', 'yearly', 'Production', 5),
48-
('sales', 'float', 'yearly', 'Sales', 6);
45+
('female', 'int', 'yearly', 'Female', 3),
46+
('male', 'int', 'yearly', 'Male', 4),
47+
('production', 'float', 'yearly', 'Production', 5),
48+
('sales', 'float', 'yearly', 'Sales', 6);
4949

5050

5151

@@ -60,7 +60,7 @@ where id = 2
6060

6161

6262

63-
INSERT INTO unit_size (code, name, active, custom)
63+
INSERT INTO unit_size (code, name, enabled, custom)
6464
VALUES
6565
('1', 'Micro', TRUE, TRUE),
6666
('2', 'Small', TRUE, TRUE),
@@ -70,20 +70,20 @@ where id = 2
7070

7171
--hide the original ones
7272
update unit_size
73-
set active = FALSE
73+
set enabled = FALSE
7474
where custom = FALSE;
7575

7676

7777
UPDATE status
78-
SET active = FALSE
78+
SET enabled = FALSE
7979
WHERE custom = FALSE;
8080

8181
--select * from status
8282

8383

8484

8585
INSERT INTO status
86-
(code, name, assigned_by_default, used_for_counting, priority, active, custom)
86+
(code, name, assigned_by_default, used_for_counting, priority, enabled, custom)
8787
VALUES
8888
('active', 'Active', TRUE, TRUE, 3, TRUE, TRUE),
8989
('closed', 'Closed', FALSE, false, 4, TRUE, TRUE),

custom/ma.sql

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
\ir ./reset.sql
44

5-
6-
CREATE OR REPLACE PROCEDURE public.custom_setup_ma()
7-
LANGUAGE plpgsql
5+
CREATE OR REPLACE PROCEDURE public.custom_setup_ma(
6+
)
7+
LANGUAGE 'plpgsql'
88
AS $BODY$
9+
910
BEGIN
1011

1112
RAISE NOTICE 'Runs MA at %', now();
12-
CALL public.custom_setup_reset();
13+
---CALL public.custom_setup_reset();
1314

1415

1516
INSERT INTO external_ident_type (code, name, priority)
@@ -19,15 +20,15 @@ BEGIN
1920
('ice_ident', 'Ice', 5);
2021

2122

22-
UPDATE external_ident_type
23-
SET archived = FALSE
24-
WHERE id <= 2;
23+
--UPDATE external_ident_type
24+
--SET enabled = FALSE
25+
-- WHERE id <= 2;
2526

2627

2728

2829
-- hide stat_ident
2930
UPDATE external_ident_type
30-
SET archived = TRUE
31+
SET enabled = FALSE
3132
WHERE code = 'stat_ident';
3233

3334

@@ -45,7 +46,7 @@ BEGIN
4546
('CNSS2022', 'CNSS2022');
4647

4748
UPDATE data_source
48-
SET active = TRUE;
49+
SET enabled = TRUE;
4950

5051

5152
INSERT INTO stat_definition (code, type, frequency, name, priority)
@@ -58,7 +59,7 @@ BEGIN
5859

5960

6061

61-
INSERT INTO unit_size (code, name, active, custom)
62+
INSERT INTO unit_size (code, name, enabled, custom)
6263
VALUES
6364
('tpe', 'Tiny', TRUE, TRUE),
6465
('p', 'Petit', TRUE, TRUE),
@@ -68,20 +69,19 @@ BEGIN
6869

6970
--hide the original ones
7071
update unit_size
71-
set active = FALSE
72+
set enabled = FALSE
7273
where custom = FALSE;
7374

7475

7576
UPDATE status
76-
SET active = FALSE
77+
SET enabled = FALSE
7778
WHERE custom = FALSE;
7879

7980
--select * from status
8081

8182

82-
8383
INSERT INTO status
84-
(code, name, assigned_by_default, used_for_counting, priority, active, custom)
84+
(code, name, assigned_by_default, used_for_counting, priority, enabled, custom)
8585
VALUES
8686
('act', 'Active', TRUE, TRUE, 3, TRUE, TRUE),
8787
('inact', 'Inactive', FALSE, false, 4, TRUE, TRUE),
@@ -93,6 +93,8 @@ where custom = FALSE;
9393
RAISE NOTICE 'Done MA at %', now();
9494

9595
END;
96+
97+
9698
$BODY$;
9799

98100
CALL public.custom_setup_ma();

custom/ug.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ AS $BODY$
88
BEGIN
99

1010
RAISE NOTICE 'Runs Uganda Kampala at %', now();
11-
CALL public.custom_setup_reset();
11+
--CALL public.custom_setup_reset();
1212

1313

1414
INSERT INTO external_ident_type (code, name, priority)
@@ -17,7 +17,7 @@ BEGIN
1717

1818

1919
UPDATE external_ident_type
20-
SET archived = FALSE
20+
SET enabled = FALSE
2121
WHERE id <= 2;
2222

2323

@@ -31,4 +31,4 @@ BEGIN
3131
END;
3232
$BODY$;
3333

34-
CALL public.custom_setup_ug();
34+
CALL public.custom_setup_ug();

0 commit comments

Comments
 (0)