maraidb compose file

This commit is contained in:
Chakib Benziane 2019-03-24 12:10:56 +01:00
parent 9b18f725d1
commit 0145558cc8
2 changed files with 20 additions and 10 deletions

View File

@ -1,13 +1,13 @@
version: "3.4" version: "3.4"
volumes: volumes:
#redis: db:
file-storage: file-storage:
sqlite: sqlite:
gocache: gocache:
services: services:
bit4sat: app:
image: sp4ke/bit4sat image: sp4ke/bit4sat
build: ./docker build: ./docker
environment: environment:
@ -30,11 +30,21 @@ services:
working_dir: /src working_dir: /src
maria:
image: mariadb:latest
environment:
- MYSQL_ROOT_PASSWORD=pass
- MYSQL_DATABASE=bit4sat
- MYSQL_USER=bit4sat
- MYSQL_PASSWORD=bit4sat
volumes:
- db:/var/lib/mysql
#redis: #redis:
#image: redis:alpine #image: redis:alpine
#volumes: #volumes:
#- redis:/data #- db:/data
#command: #command:
#- redis-server #- redis-server

View File

@ -15,13 +15,13 @@ var DB = db.DB
const ( const (
DBUploadSchema = ` DBUploadSchema = `
CREATE TABLE IF NOT EXISTS "upload" ( CREATE TABLE IF NOT EXISTS "upload" (
upload_id TEXT NOT NULL, upload_id CHAR(20) NOT NULL,
sha256 TEXT NOT NULL, sha256 CHAR(32) NOT NULL,
file_name TEXT NOT NULL, file_name CHAR(255) NOT NULL,
file_type TEXT DEFAULT '', file_type CHAR(255) DEFAULT '',
file_size INTEGER NOT NULL, file_size INT NOT NULL,
file_ext TEXT DEFAULT '', file_ext CHAR(255) DEFAULT '',
status INTEGER DEFAULT 0, status INT DEFAULT 0,
FOREIGN KEY (status) REFERENCES upload_status(type), FOREIGN KEY (status) REFERENCES upload_status(type),
UNIQUE (upload_id, sha256) UNIQUE (upload_id, sha256)
); );