Browse Source

database scripts

Andrew Grant 7 months ago
parent
commit
8260e1841b

+ 3 - 0
scripts/copy_uat_to_prod.txt

@@ -0,0 +1,3 @@
+# Assumes both exist
+mysqldump -u apg -p grants_uat > dump.sql
+mysql -u apg -p grants_prod < dump.sql

+ 15 - 0
scripts/create_prod.txt

@@ -0,0 +1,15 @@
+as root mysql -u root
+CREATE DATABASE grants_prod;
+
+#Create database service accounts
+CREATE USER 'grants_prod_user'@'%' IDENTIFIED BY 'abigail';
+CREATE USER 'apg'@'%' IDENTIFIED BY <suzanne>;
+
+
+#Database grants
+GRANT ALL PRIVILEGES ON grants_prod.* to 'apg'@'%';
+GRANT SELECT ON grants_prod.* to 'grants_prod_user'@'%';
+GRANT INSERT ON grants_prod.* to 'grants_prod_user'@'%';
+GRANT DELETE ON grants_prod.* to 'grants_prod_user'@'%';
+GRANT UPDATE ON grants_prod.* to 'grants_prod_user'@'%';
+FLUSH PRIVILEGES;

+ 15 - 0
scripts/create_uat.txt

@@ -0,0 +1,15 @@
+as root mysql -u root
+CREATE DATABASE grants_uat;
+
+#Create database service accounts
+CREATE USER 'grants_uat_user'@'%' IDENTIFIED BY 'abigail';
+CREATE USER 'apg'@'%' IDENTIFIED BY <suzanne>;
+
+
+#Database grants
+GRANT ALL PRIVILEGES ON grants_uat.* to 'apg'@'%';
+GRANT SELECT ON grants_uat.* to 'grants_uat_user'@'%';
+GRANT INSERT ON grants_uat.* to 'grants_uat_user'@'%';
+GRANT DELETE ON grants_uat.* to 'grants_uat_user'@'%';
+GRANT UPDATE ON grants_uat.* to 'grants_uat_user'@'%';
+FLUSH PRIVILEGES;

+ 1 - 1
src/main/resources/application.properties

@@ -2,7 +2,7 @@ spring.application.name=grants
 server.port=8086
 server.servlet.context-path=/grants
 spring.mvc.format.date=dd-MM-yyyy
-spring.profiles.active=dev
+spring.profiles.active=uat
 logging.level.scot.carricksoftware=debug
 
 

+ 15 - 0
src/main/resources/db/changelog/2025/04/22-01-changelog.sql

@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
+ *
+ */
+
+-- liquibase formatted sql
+
+-- changeset apg:1745301546038-1
+
+-- changeset apg:1745301546038-2
+ALTER TABLE census
+    ADD inhabited_rooms    VARCHAR(255) NULL,
+    ADD rooms_with_windows VARCHAR(255) NULL;
+
+

+ 1 - 0
src/main/resources/db/changelog/master.xml

@@ -9,5 +9,6 @@
     <include file="/db/changelog/2025/04/16-01-changelog.sql"/>
     <include file="/db/changelog/2025/04/17-01-changelog.sql"/>
     <include file="/db/changelog/2025/04/19-01-changelog.sql"/>
+    <include file="/db/changelog/2025/04/22-01-changelog.sql"/>
 
 </databaseChangeLog>