Skip to content
Snippets Groups Projects
Commit 9ce3964b authored by nicolas.paschoud's avatar nicolas.paschoud
Browse files

Database is ready

parent 00a7d3fa
No related branches found
No related tags found
No related merge requests found
USE hyperdrive;
INSERT INTO Users
VALUES
("a", "test"),
("b", "test"),
("c", "test"),
("d", "test"),
("e", "test");
INSERT INTO Paths
VALUES
("/a", "a", NULL),
("/a/coucou", "a", "/a"),
("/b", "b", NULL),
("/c", "c", NULL),
("/c/test", "c", "/c"),
("/d", "d", NULL),
("/e", "e", NULL);
INSERT INTO Files
VALUES
("abcd", "un", "/a"),
("ab", "deux", "/a"),
("@dfsg", "trois", "/c/test"),
("gbvaf", "quatre", "/b"),
("dsfgh", "cinq", "/d"),
("sdfa", "six", "/e");
INSERT INTO Shares
VALUES
("a", "b", "abcd"),
("a", "c", "abcd"),
("a", "d", "abcd"),
("c", "e", "@dfsg");
version: '3'
services:
db:
image: mysql
restart: always
container_name: hyperdrive
environment:
MYSQL_ROOT_PASSWORD: super
MYSQL_DATABASE: hyperdrive
MYSQL_USER: hyperdrive
MYSQL_PASSWORD: hyper
ports:
- '3306:3306'
expose:
- 3306
volumes:
- ./hyperdrive.sql:/docker-entrypoint-initdb.d/hyperdrive.sql
\ No newline at end of file
CREATE DATABASE IF NOT EXISTS `hyperdrive` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `hyperdrive`;
-- Creating tables
CREATE TABLE IF NOT EXISTS Users (
pseudo varchar(60) NOT NULL,
passwd varchar(256) NOT NULL,
......@@ -33,3 +35,39 @@ CREATE TABLE IF NOT EXISTS Shares (
FOREIGN KEY (pseudo_2) REFERENCES Users(pseudo),
FOREIGN KEY (file_id) REFERENCES Files(file_id)
);
-- Inserting datas
INSERT INTO Users
VALUES
("a", "test"),
("b", "test"),
("c", "test"),
("d", "test"),
("e", "test");
INSERT INTO Paths
VALUES
("/a", "a", NULL),
("/a/coucou", "a", "/a"),
("/b", "b", NULL),
("/c", "c", NULL),
("/c/test", "c", "/c"),
("/d", "d", NULL),
("/e", "e", NULL);
INSERT INTO Files
VALUES
("abcd", "un", "/a"),
("ab", "deux", "/a"),
("@dfsg", "trois", "/c/test"),
("gbvaf", "quatre", "/b"),
("dsfgh", "cinq", "/d"),
("sdfa", "six", "/e");
INSERT INTO Shares
VALUES
("a", "b", "abcd"),
("a", "c", "abcd"),
("a", "d", "abcd"),
("c", "e", "@dfsg");
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment