Adding DBeaver Project
This commit is contained in:
parent
2e0b20a53e
commit
c0885d9029
10 changed files with 292 additions and 0 deletions
BIN
SqlManagement/.dbeaver/.credentials-config.json.bak
Normal file
BIN
SqlManagement/.dbeaver/.credentials-config.json.bak
Normal file
Binary file not shown.
83
SqlManagement/.dbeaver/.data-sources.json.bak
Normal file
83
SqlManagement/.dbeaver/.data-sources.json.bak
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
{
|
||||||
|
"folders": {},
|
||||||
|
"connections": {
|
||||||
|
"postgres-jdbc-1948450a8b4-5fc9eec404e65c44": {
|
||||||
|
"provider": "postgresql",
|
||||||
|
"driver": "postgres-jdbc",
|
||||||
|
"name": "UB-KK01-postgres",
|
||||||
|
"save-password": true,
|
||||||
|
"configuration": {
|
||||||
|
"host": "192.168.1.57",
|
||||||
|
"port": "5432",
|
||||||
|
"database": "postgres",
|
||||||
|
"url": "jdbc:postgresql://192.168.1.57:5432/postgres",
|
||||||
|
"configurationType": "MANUAL",
|
||||||
|
"home": "postgresql_client",
|
||||||
|
"type": "dev",
|
||||||
|
"closeIdleConnection": true,
|
||||||
|
"properties": {
|
||||||
|
"connectTimeout": "20",
|
||||||
|
"loginTimeout": "20",
|
||||||
|
"escapeSyntaxCallMode": "callIfNoReturn"
|
||||||
|
},
|
||||||
|
"provider-properties": {
|
||||||
|
"@dbeaver-show-non-default-db@": "true",
|
||||||
|
"@dbeaver-chosen-role@": "",
|
||||||
|
"@dbeaver-show-template-db@": "false",
|
||||||
|
"@dbeaver-show-unavailable-db@": "false",
|
||||||
|
"show-database-statistics": "false",
|
||||||
|
"@dbeaver-read-all-data-types-db@": "false",
|
||||||
|
"read-keys-with-columns": "false",
|
||||||
|
"@dbeaver-use-prepared-statements-db@": "false",
|
||||||
|
"postgresql.dd.plain.string": "false",
|
||||||
|
"postgresql.dd.tag.string": "false"
|
||||||
|
},
|
||||||
|
"auth-model": "native"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"postgres-jdbc-19484872d85-cd2a4a40116e706": {
|
||||||
|
"provider": "postgresql",
|
||||||
|
"driver": "postgres-jdbc",
|
||||||
|
"name": "UB-KK01-sathumper",
|
||||||
|
"configuration": {
|
||||||
|
"host": "192.168.1.57",
|
||||||
|
"port": "5432",
|
||||||
|
"database": "postgres",
|
||||||
|
"url": "jdbc:postgresql://192.168.1.57:5432/postgres",
|
||||||
|
"configurationType": "MANUAL",
|
||||||
|
"home": "postgresql_client",
|
||||||
|
"type": "dev",
|
||||||
|
"closeIdleConnection": true,
|
||||||
|
"provider-properties": {
|
||||||
|
"@dbeaver-show-non-default-db@": "true",
|
||||||
|
"@dbeaver-chosen-role@": "",
|
||||||
|
"@dbeaver-show-template-db@": "false",
|
||||||
|
"@dbeaver-show-unavailable-db@": "false",
|
||||||
|
"show-database-statistics": "false",
|
||||||
|
"@dbeaver-read-all-data-types-db@": "false",
|
||||||
|
"read-keys-with-columns": "false",
|
||||||
|
"@dbeaver-use-prepared-statements-db@": "false",
|
||||||
|
"postgresql.dd.plain.string": "false",
|
||||||
|
"postgresql.dd.tag.string": "false"
|
||||||
|
},
|
||||||
|
"auth-model": "native"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"connection-types": {
|
||||||
|
"dev": {
|
||||||
|
"name": "Development",
|
||||||
|
"color": "255,255,255",
|
||||||
|
"description": "Regular development database",
|
||||||
|
"auto-commit": true,
|
||||||
|
"confirm-execute": false,
|
||||||
|
"confirm-data-change": false,
|
||||||
|
"smart-commit": false,
|
||||||
|
"smart-commit-recover": true,
|
||||||
|
"auto-close-transactions": true,
|
||||||
|
"close-transactions-period": 1800,
|
||||||
|
"auto-close-connections": true,
|
||||||
|
"close-connections-period": 14400
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1
SqlManagement/.dbeaver/credentials-config.json
Normal file
1
SqlManagement/.dbeaver/credentials-config.json
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
tðíÜÖ‰4ª’Ĭ—"xí&ÿн¨èÌ—_€ÍãEa
&7½÷gкø
·»íÍZ„hOæ•>7fqî¿7‚fþäÏ©ã+¯©áƒ$Bæé²<EFBFBD>RG=Â-ójÜ<WêPì#Og ¨§æhS!_Þ!|UÜÔ±õÁÔjŒ‹~I²=ú
|
||||||
83
SqlManagement/.dbeaver/data-sources.json
Normal file
83
SqlManagement/.dbeaver/data-sources.json
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
{
|
||||||
|
"folders": {},
|
||||||
|
"connections": {
|
||||||
|
"postgres-jdbc-1948450a8b4-5fc9eec404e65c44": {
|
||||||
|
"provider": "postgresql",
|
||||||
|
"driver": "postgres-jdbc",
|
||||||
|
"name": "UB-KK01-postgres",
|
||||||
|
"save-password": true,
|
||||||
|
"configuration": {
|
||||||
|
"host": "192.168.1.57",
|
||||||
|
"port": "5432",
|
||||||
|
"database": "postgres",
|
||||||
|
"url": "jdbc:postgresql://192.168.1.57:5432/postgres",
|
||||||
|
"configurationType": "MANUAL",
|
||||||
|
"home": "postgresql_client",
|
||||||
|
"type": "dev",
|
||||||
|
"closeIdleConnection": true,
|
||||||
|
"properties": {
|
||||||
|
"connectTimeout": "20",
|
||||||
|
"loginTimeout": "20",
|
||||||
|
"escapeSyntaxCallMode": "callIfNoReturn"
|
||||||
|
},
|
||||||
|
"provider-properties": {
|
||||||
|
"@dbeaver-show-non-default-db@": "true",
|
||||||
|
"@dbeaver-chosen-role@": "",
|
||||||
|
"@dbeaver-show-template-db@": "false",
|
||||||
|
"@dbeaver-show-unavailable-db@": "false",
|
||||||
|
"show-database-statistics": "false",
|
||||||
|
"@dbeaver-read-all-data-types-db@": "false",
|
||||||
|
"read-keys-with-columns": "false",
|
||||||
|
"@dbeaver-use-prepared-statements-db@": "false",
|
||||||
|
"postgresql.dd.plain.string": "false",
|
||||||
|
"postgresql.dd.tag.string": "false"
|
||||||
|
},
|
||||||
|
"auth-model": "native"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"postgres-jdbc-19484872d85-cd2a4a40116e706": {
|
||||||
|
"provider": "postgresql",
|
||||||
|
"driver": "postgres-jdbc",
|
||||||
|
"name": "UB-KK01-sathumper",
|
||||||
|
"configuration": {
|
||||||
|
"host": "192.168.1.57",
|
||||||
|
"port": "5432",
|
||||||
|
"database": "postgres",
|
||||||
|
"url": "jdbc:postgresql://192.168.1.57:5432/postgres",
|
||||||
|
"configurationType": "MANUAL",
|
||||||
|
"home": "postgresql_client",
|
||||||
|
"type": "dev",
|
||||||
|
"closeIdleConnection": true,
|
||||||
|
"provider-properties": {
|
||||||
|
"@dbeaver-show-non-default-db@": "true",
|
||||||
|
"@dbeaver-chosen-role@": "",
|
||||||
|
"@dbeaver-show-template-db@": "false",
|
||||||
|
"@dbeaver-show-unavailable-db@": "false",
|
||||||
|
"show-database-statistics": "false",
|
||||||
|
"@dbeaver-read-all-data-types-db@": "false",
|
||||||
|
"read-keys-with-columns": "false",
|
||||||
|
"@dbeaver-use-prepared-statements-db@": "false",
|
||||||
|
"postgresql.dd.plain.string": "false",
|
||||||
|
"postgresql.dd.tag.string": "false"
|
||||||
|
},
|
||||||
|
"auth-model": "native"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"connection-types": {
|
||||||
|
"dev": {
|
||||||
|
"name": "Development",
|
||||||
|
"color": "255,255,255",
|
||||||
|
"description": "Regular development database",
|
||||||
|
"auto-commit": true,
|
||||||
|
"confirm-execute": false,
|
||||||
|
"confirm-data-change": false,
|
||||||
|
"smart-commit": false,
|
||||||
|
"smart-commit-recover": true,
|
||||||
|
"auto-close-transactions": true,
|
||||||
|
"close-transactions-period": 1800,
|
||||||
|
"auto-close-connections": true,
|
||||||
|
"close-connections-period": 14400
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1
SqlManagement/.dbeaver/project-settings.json
Normal file
1
SqlManagement/.dbeaver/project-settings.json
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"id":"830a3048-5c54-4a87-8ff6-d6cb932e9704"}
|
||||||
12
SqlManagement/.project
Normal file
12
SqlManagement/.project
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>PlanTempus</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.jkiss.dbeaver.DBeaverNature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
||||||
2
SqlManagement/Dashboards/Test.dashboard
Normal file
2
SqlManagement/Dashboards/Test.dashboard
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<dashboardList/>
|
||||||
5
SqlManagement/Diagrams/global.erd
Normal file
5
SqlManagement/Diagrams/global.erd
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<diagram version="1" name="global">
|
||||||
|
<entities/>
|
||||||
|
<relations/>
|
||||||
|
</diagram>
|
||||||
96
SqlManagement/Scripts/Script-2.sql
Normal file
96
SqlManagement/Scripts/Script-2.sql
Normal file
|
|
@ -0,0 +1,96 @@
|
||||||
|
|
||||||
|
GRANT USAGE, CREATE ON SCHEMA swp TO sathumper;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES IN SCHEMA swp
|
||||||
|
GRANT ALL PRIVILEGES ON TABLES TO sathumper;
|
||||||
|
|
||||||
|
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA swp TO sathumper;
|
||||||
|
|
||||||
|
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA swp TO sathumper;
|
||||||
|
|
||||||
|
|
||||||
|
select * from dev.app_configuration
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION dev.notify_config_change()
|
||||||
|
RETURNS TRIGGER AS $$
|
||||||
|
BEGIN
|
||||||
|
IF TG_OP = 'DELETE' THEN
|
||||||
|
PERFORM pg_notify(
|
||||||
|
'config_changes',
|
||||||
|
json_build_object('operation', TG_OP, 'data', row_to_json(OLD))::text
|
||||||
|
);
|
||||||
|
RETURN OLD; -- Return OLD for DELETE operations
|
||||||
|
ELSE
|
||||||
|
PERFORM pg_notify(
|
||||||
|
'config_changes',
|
||||||
|
json_build_object('operation', TG_OP, 'data', row_to_json(NEW))::text
|
||||||
|
);
|
||||||
|
RETURN NEW; -- Return NEW for INSERT/UPDATE operations
|
||||||
|
END IF;
|
||||||
|
END;
|
||||||
|
$$ LANGUAGE plpgsql;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- Trigger på configuration tabellen
|
||||||
|
CREATE TRIGGER config_change_trigger
|
||||||
|
AFTER INSERT OR UPDATE OR DELETE ON dev.app_configuration
|
||||||
|
FOR EACH ROW EXECUTE FUNCTION dev.notify_config_change();
|
||||||
|
|
||||||
|
|
||||||
|
update dev.app_configuration
|
||||||
|
set "label" = "label" where id = 3
|
||||||
|
|
||||||
|
SELECT row_to_json(t)
|
||||||
|
FROM (SELECT 1 as id, 'test' as key) t;
|
||||||
|
|
||||||
|
SET myapp.tenant_id = '1';
|
||||||
|
|
||||||
|
SHOW myapp.tenant_id;
|
||||||
|
|
||||||
|
create TABLE dev.app_configuration1 (
|
||||||
|
tenant_id varchar(25),
|
||||||
|
config_key VARCHAR(255),
|
||||||
|
config_value TEXT,
|
||||||
|
PRIMARY KEY (tenant_id, config_key)
|
||||||
|
);
|
||||||
|
|
||||||
|
ALTER TABLE dev.app_configuration1 ENABLE ROW LEVEL SECURITY;
|
||||||
|
|
||||||
|
CREATE drop POLICY tenant_policy
|
||||||
|
ON dev.app_configuration1
|
||||||
|
FOR SELECT
|
||||||
|
USING (
|
||||||
|
current_setting('myapp.tenant_id', true) IS NOT NULL AND
|
||||||
|
tenant_id = current_setting('myapp.tenant_id')::INT
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE POLICY tenant_policy
|
||||||
|
ON dev.app_configuration1
|
||||||
|
FOR SELECT
|
||||||
|
USING (
|
||||||
|
tenant_id::text = current_user
|
||||||
|
);
|
||||||
|
|
||||||
|
insert into dev.app_configuration1
|
||||||
|
(tenant_id, config_key, config_value) values('dev', 't2', 'best dat')
|
||||||
|
|
||||||
|
SET myapp.tenant_id = 0
|
||||||
|
|
||||||
|
ALTER USER din_bruger NOBYPASS RLS;
|
||||||
|
select * from dev.app_configuration1
|
||||||
|
|
||||||
|
SHOW row_security;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
GRANT USAGE, CREATE ON SCHEMA dev TO sathumper;
|
||||||
|
|
||||||
|
ALTER DEFAULT PRIVILEGES IN SCHEMA dev
|
||||||
|
GRANT ALL PRIVILEGES ON TABLES TO sathumper;
|
||||||
|
|
||||||
|
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA dev TO sathumper;
|
||||||
|
|
||||||
|
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA dev TO sathumper;
|
||||||
|
|
||||||
9
SqlManagement/Scripts/Script.sql
Normal file
9
SqlManagement/Scripts/Script.sql
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
CREATE TABLE IF NOT EXISTS swp.users (
|
||||||
|
id SERIAL PRIMARY KEY,
|
||||||
|
email VARCHAR(256) NOT NULL UNIQUE,
|
||||||
|
password_hash VARCHAR(256) NOT NULL,
|
||||||
|
security_stamp VARCHAR(36) NOT NULL,
|
||||||
|
email_confirmed BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
|
created_date TIMESTAMP NOT NULL,
|
||||||
|
last_login_date TIMESTAMP NULL
|
||||||
|
);
|
||||||
Loading…
Add table
Add a link
Reference in a new issue