Repository navigation
Expand file tree
/
Copy path010_audit.sql
More file actions
52 lines (44 loc) · 1.67 KB
/
Copy path010_audit.sql
File metadata and controls
52 lines (44 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
-- +migrate Up
ALTER table project_variable_audit RENAME TO project_variable_audit_old;
CREATE TABLE IF NOT EXISTS "project_variable_audit" (
id BIGSERIAL PRIMARY KEY,
project_id BIGINT,
variable_id BIGINT,
type TEXT,
variable_before JSONB,
variable_after JSONB,
versionned TIMESTAMP WITH TIME ZONE,
author TEXT
);
select create_index('project_variable_audit', 'IDX_PROJECT_VARIABLE_AUDIT_IDS', 'project_id,variable_id');
ALTER table application_variable_audit RENAME TO application_variable_audit_old;
CREATE TABLE IF NOT EXISTS "application_variable_audit" (
id BIGSERIAL PRIMARY KEY,
application_id BIGINT,
variable_id BIGINT,
type TEXT,
variable_before JSONB,
variable_after JSONB,
versionned TIMESTAMP WITH TIME ZONE,
author TEXT
);
select create_index('application_variable_audit', 'IDX_APPLICATION_VARIABLE_AUDIT_IDS', 'application_id,variable_id');
ALTER table environment_variable_audit RENAME TO environment_variable_audit_old;
CREATE TABLE IF NOT EXISTS "environment_variable_audit" (
id BIGSERIAL PRIMARY KEY,
environment_id BIGINT,
variable_id BIGINT,
type TEXT,
variable_before JSONB,
variable_after JSONB,
versionned TIMESTAMP WITH TIME ZONE,
author TEXT
);
select create_index('environment_variable_audit', 'IDX_ENVIRONMENT_VARIABLE_AUDIT_IDS', 'environment_id,variable_id');
-- +migrate Down
DROP TABLE project_variable_audit;
DROP TABLE application_variable_audit;
DROP TABLE environment_variable_audit;
ALTER table project_variable_audit_old RENAME TO project_variable_audit;
ALTER table application_variable_audit_old RENAME TO application_variable_audit;
ALTER table environment_variable_audit_old RENAME TO environment_variable_audit;