ci: add first draft of MySQL data schema
This commit is contained in:
parent
1862ccbbb6
commit
57d6d82be9
3 changed files with 60 additions and 5 deletions
|
@ -1,7 +1,7 @@
|
||||||
FROM composer
|
FROM composer
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY composer.* .
|
COPY www/composer.* .
|
||||||
RUN composer install
|
RUN composer install
|
||||||
|
|
||||||
FROM php:apache
|
FROM php:apache
|
||||||
|
@ -14,5 +14,5 @@ RUN a2enmod rewrite
|
||||||
RUN a2enmod headers
|
RUN a2enmod headers
|
||||||
RUN docker-php-ext-install mysqli && docker-php-ext-enable mysqli
|
RUN docker-php-ext-install mysqli && docker-php-ext-enable mysqli
|
||||||
|
|
||||||
COPY . .
|
COPY www/ .
|
||||||
RUN chmod -R a+r $(ls -I vendor)
|
RUN chmod -R a+r $(ls -I vendor)
|
||||||
|
|
|
@ -9,11 +9,12 @@ services:
|
||||||
watch:
|
watch:
|
||||||
- path: ./
|
- path: ./
|
||||||
action: rebuild
|
action: rebuild
|
||||||
- path: ../.
|
- path: ../www/
|
||||||
action: sync
|
action: sync
|
||||||
target: /var/www/html
|
target: /var/www/html
|
||||||
ignore:
|
ignore:
|
||||||
- ../.git
|
- ../.git
|
||||||
|
- mysql_schema.sql
|
||||||
mysql:
|
mysql:
|
||||||
build:
|
build:
|
||||||
dockerfile: MysqlDockerfile
|
dockerfile: MysqlDockerfile
|
||||||
|
@ -23,7 +24,13 @@ services:
|
||||||
restart: always
|
restart: always
|
||||||
environment:
|
environment:
|
||||||
MYSQL_ROOT_PASSWORD: example
|
MYSQL_ROOT_PASSWORD: example
|
||||||
volumes:
|
ports:
|
||||||
- sqlvolume:/var/lib/mysql
|
- 3306:3306
|
||||||
|
develop:
|
||||||
|
watch:
|
||||||
|
- path: mysql_schema.sql
|
||||||
|
action: rebuild
|
||||||
|
# volumes:
|
||||||
|
# - sqlvolume:/var/lib/mysql
|
||||||
volumes:
|
volumes:
|
||||||
sqlvolume: {}
|
sqlvolume: {}
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
|
||||||
|
CREATE DATABASE dragon_fire;
|
||||||
|
|
||||||
|
USE dragon_fire;
|
||||||
|
|
||||||
|
CREATE TABLE posts (
|
||||||
|
post_id INTEGER AUTO_INCREMENT,
|
||||||
|
|
||||||
|
post_path VARCHAR(255) NOT NULL,
|
||||||
|
post_path_depth INTEGER NOT NULL DEFAULT 0,
|
||||||
|
|
||||||
|
post_title TEXT,
|
||||||
|
post_description TEXT,
|
||||||
|
post_brief TEXT,
|
||||||
|
|
||||||
|
post_content MEDIUMTEXT,
|
||||||
|
post_content_type TEXT,
|
||||||
|
|
||||||
|
PRIMARY KEY(post_id),
|
||||||
|
CONSTRAINT unique_post_path UNIQUE (post_path),
|
||||||
|
|
||||||
|
INDEX(post_path),
|
||||||
|
INDEX(post_path_depth, post_path)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE post_tags (
|
||||||
|
post_id INTEGER,
|
||||||
|
tag VARCHAR(255),
|
||||||
|
|
||||||
|
CONSTRAINT post_fkey
|
||||||
|
FOREIGN KEY(post_id) REFERENCES posts(post_id)
|
||||||
|
ON DELETE CASCADE,
|
||||||
|
|
||||||
|
INDEX(post_id),
|
||||||
|
INDEX(tag)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO posts (post_path, post_title, post_content)
|
||||||
|
VALUES (
|
||||||
|
'/about',
|
||||||
|
'About the Dergs',
|
||||||
|
'
|
||||||
|
# About the dergs indeed
|
||||||
|
|
||||||
|
This is just a simple test. Might be nice, though!
|
||||||
|
'
|
||||||
|
);
|
Loading…
Add table
Add a link
Reference in a new issue