summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2017-11-28 15:43:51 +0100
committerGitHub <noreply@github.com>2017-11-28 15:43:51 +0100
commit599f2fd264bfc7b1b6826fe206442806e317340f (patch)
tree50cf84d7d07d11bd65b45c2c17f37632f6cd8eff /db
parenta5fc5bd0979e8de1fce8a8addd351a6e7bd6aeb8 (diff)
parenteda7f7788ea8012bd8be46405c56a666c11f3fa5 (diff)
Merge pull request #365 from engelsystem/feature-igel-rewrite
Feature igel rewrite
Diffstat (limited to 'db')
-rw-r--r--db/anonymize.sql10
-rw-r--r--db/install.sql4
-rw-r--r--db/update.sql29
3 files changed, 32 insertions, 11 deletions
diff --git a/db/anonymize.sql b/db/anonymize.sql
new file mode 100644
index 00000000..ba420d79
--- /dev/null
+++ b/db/anonymize.sql
@@ -0,0 +1,10 @@
+update User set Nick=concat('User',UID), Name=concat('Name',UID), Vorname=concat('Prename',UID), `Alter`=0, Telefon='', DECT='', Handy='', email=concat('engel', UID, '@engelsystem.de'), jabber='', Hometown='';
+update Messages set Text=concat('Message', id);
+update News set Betreff=concat('Subject', ID), Text=concat('News', ID);
+update NewsComments set Text=concat('Comment', ID);
+update Questions set Question=concat('Question', QID), Answer=concat('Answer', QID);
+update ShiftEntry set Comment='', freeload_comment='';
+update ShiftTypes set name=concat('Shifttype',id), description='Description';
+update AngelTypes set name=concat('Angeltype',id), description=concat('Description of angeltype',id);
+TRUNCATE TABLE LogEntries;
+
diff --git a/db/install.sql b/db/install.sql
index 0222dc08..3c3e41e6 100644
--- a/db/install.sql
+++ b/db/install.sql
@@ -205,7 +205,7 @@ DROP TABLE IF EXISTS `NewsComments`;
CREATE TABLE `NewsComments` (
`ID` bigint(11) NOT NULL,
`Refid` int(11) NOT NULL DEFAULT '0',
- `Datum` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `Datum` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
`Text` text NOT NULL,
`UID` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -395,7 +395,7 @@ CREATE TABLE `User` (
`Sprache` char(64) NOT NULL,
`Menu` char(1) NOT NULL DEFAULT 'L',
`lastLogIn` int(11) NOT NULL,
- `CreateDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `CreateDate` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
`Art` varchar(30) DEFAULT NULL,
`kommentar` text,
`Hometown` varchar(255) NOT NULL DEFAULT '',
diff --git a/db/update.sql b/db/update.sql
index dd203a86..c5187675 100644
--- a/db/update.sql
+++ b/db/update.sql
@@ -8,19 +8,30 @@ ALTER TABLE `User` ADD COLUMN `email_by_human_allowed` BOOLEAN NOT NULL;
-- No Self Sign Up for some Angel Types
ALTER TABLE AngelTypes ADD no_self_signup TINYINT(1) NOT NULL;
-ALTER TABLE `AngelTypes`
- ADD `contact_user_id` INT NULL,
- ADD `contact_name` VARCHAR(250) NULL,
- ADD `contact_dect` VARCHAR(5) NULL,
- ADD `contact_email` VARCHAR(250) NULL,
+ALTER TABLE `AngelTypes`
+ ADD `contact_user_id` INT NULL,
+ ADD `contact_name` VARCHAR(250) NULL,
+ ADD `contact_dect` VARCHAR(5) NULL,
+ ADD `contact_email` VARCHAR(250) NULL,
ADD INDEX (`contact_user_id`);
-ALTER TABLE `AngelTypes`
+ALTER TABLE `AngelTypes`
ADD FOREIGN KEY (`contact_user_id`) REFERENCES `User`(`UID`) ON DELETE SET NULL ON UPDATE CASCADE;
-
INSERT INTO `Privileges` (`id`, `name`, `desc`) VALUES (NULL, 'shiftentry_edit_angeltype_supporter', 'If user with this privilege is angeltype supporter, he can put users in shifts for their angeltype');
-
-- DB Performance
ALTER TABLE `Shifts` ADD INDEX(`start`);
-ALTER TABLE `NeededAngelTypes` ADD INDEX(`count`); \ No newline at end of file
+ALTER TABLE `NeededAngelTypes` ADD INDEX(`count`);
+
+-- Security
+UPDATE `Groups` SET UID = UID * 10;
+INSERT INTO `Groups` (Name, UID) VALUES ('News Admin', -65);
+INSERT INTO `Privileges` (id, name, `desc`) VALUES (42, 'admin_news_html', 'Use HTML in news');
+INSERT INTO `GroupPrivileges` (group_id, privilege_id) VALUES (-65, 14), (-65, 42);
+
+-- Add log level to LogEntries
+ALTER TABLE `LogEntries` CHANGE COLUMN `nick` `level` VARCHAR(20) NOT NULL;
+
+-- Angeltype contact update
+ALTER TABLE `AngelTypes` DROP FOREIGN KEY angeltypes_ibfk_1;
+ALTER TABLE `AngelTypes` DROP `contact_user_id`; \ No newline at end of file