summaryrefslogtreecommitdiffstats
path: root/populate.sql
blob: bb7821b8bdf7cc2d38d0f7bfd03a8f9dff4a1086 (plain) (blame)
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
/* CREATE OR REPLACE DATABASE ded CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; */

/* Switch to using it. */
USE ded;

/* Create the Organisations table. */
DROP TABLE IF EXISTS organisations;
CREATE TABLE organisations (
    id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
    name VARCHAR(100) NOT NULL,
    created DATETIME NOT NULL
);

/* Add index to created column. */
CREATE INDEX idx_organsations_created ON organisations(created);

-- Let's add some placeholder data to organisations table.
INSERT INTO organisations (name, created) VALUES ("Random Organisation 1", UTC_TIMESTAMP());
INSERT INTO organisations (name, created) VALUES ("Random Organisation 2", UTC_TIMESTAMP());
INSERT INTO organisations (name, created) VALUES ("Random Organisation 3", UTC_TIMESTAMP());

/* /1* The following should be carried out on the database server *1/ */
/* -- CREATE USER 'web'@'localhost'; */
/* -- GRANT SELECT, INSERT, UPDATE, DELETE ON ded.* TO 'web'@'localhost'; */
/* /1* Important: Make sure to swap 'pass' with a password of your own choosing. *1/ */
/* -- ALTER USER 'web'@'localhost' IDENTIFIED BY 'dedpassword'; */