Eerste commit
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
-- MijnBesluit - instelling voor het overzicht
|
||||
--
|
||||
-- Voegt aan `users` toe hoeveel dagen vooruit iemand op zijn overzicht wil zien wat eraan komt.
|
||||
-- 0 betekent: niets tonen. Standaard 30, maximaal 60.
|
||||
--
|
||||
-- Draaien met:
|
||||
-- mysql -u root -p mijnbesluit < db\06_vooruitblik.sql
|
||||
--
|
||||
-- Opnieuw draaien mag: er gebeurt dan niets.
|
||||
|
||||
USE `mijnbesluit`;
|
||||
|
||||
SET @bestaat := (
|
||||
SELECT COUNT(*) FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'users' AND COLUMN_NAME = 'vooruitblik_dagen');
|
||||
|
||||
SET @sql := IF(@bestaat = 0,
|
||||
'ALTER TABLE `users` ADD COLUMN `vooruitblik_dagen` INT NOT NULL DEFAULT 30',
|
||||
'SELECT "vooruitblik_dagen bestaat al" AS melding');
|
||||
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
|
||||
|
||||
SELECT 'Klaar: vooruitblik-instelling toegevoegd aan users.' AS melding;
|
||||
Reference in New Issue
Block a user