New DB container for tests
This commit is contained in:
parent
2c9f42af29
commit
31bc41c5ec
3 changed files with 94 additions and 2 deletions
|
@ -27,7 +27,7 @@ services:
|
||||||
- _APP_STATSD_PORT=8125
|
- _APP_STATSD_PORT=8125
|
||||||
|
|
||||||
mariadb:
|
mariadb:
|
||||||
image: mariadb:10.2
|
build: ./docker/mariadb
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
- MYSQL_ROOT_PASSWORD=password
|
- MYSQL_ROOT_PASSWORD=password
|
||||||
|
@ -35,7 +35,6 @@ services:
|
||||||
- ./storage/db:/var/lib/mysql:rw
|
- ./storage/db:/var/lib/mysql:rw
|
||||||
ports:
|
ports:
|
||||||
- 3306:3306/tcp
|
- 3306:3306/tcp
|
||||||
command: mysqld --innodb-flush-method=fsync
|
|
||||||
|
|
||||||
smtp:
|
smtp:
|
||||||
image: appwrite/smtp:1.0.0
|
image: appwrite/smtp:1.0.0
|
||||||
|
|
10
tests/resources/docker/mariadb/Dockerfile
Normal file
10
tests/resources/docker/mariadb/Dockerfile
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
FROM mariadb:10.2
|
||||||
|
|
||||||
|
LABEL maintainer="team@appwrite.io"
|
||||||
|
|
||||||
|
# Add appwrite schema and tables
|
||||||
|
ADD ./all.sql /docker-entrypoint-initdb.d/all.sql
|
||||||
|
|
||||||
|
RUN chown -R mysql:mysql /docker-entrypoint-initdb.d/
|
||||||
|
|
||||||
|
CMD [ "mysqld", "--innodb-flush-method=fsync" ]
|
83
tests/resources/docker/mariadb/all.sql
Normal file
83
tests/resources/docker/mariadb/all.sql
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
CREATE DATABASE IF NOT EXISTS `appwrite` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
|
||||||
|
|
||||||
|
USE `appwrite`;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `template.abuse.abuse` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`_key` varchar(255) NOT NULL,
|
||||||
|
`_time` varchar(45) NOT NULL,
|
||||||
|
`_count` int(11) NOT NULL DEFAULT '0',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `unique1` (`_key`,`_time`),
|
||||||
|
KEY `index1` (`_key`,`_time`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `template.audit.audit` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`userId` varchar(45) NOT NULL,
|
||||||
|
`userType` int(11) NOT NULL,
|
||||||
|
`event` varchar(45) NOT NULL,
|
||||||
|
`resource` varchar(45) DEFAULT NULL,
|
||||||
|
`userAgent` text NOT NULL,
|
||||||
|
`ip` varchar(45) NOT NULL,
|
||||||
|
`location` varchar(45) DEFAULT NULL,
|
||||||
|
`time` datetime NOT NULL,
|
||||||
|
`data` longtext DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `id_UNIQUE` (`id`),
|
||||||
|
KEY `index_1` (`userId`,`userType`),
|
||||||
|
KEY `index_2` (`event`),
|
||||||
|
KEY `index_3` (`resource`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `template.database.documents` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique ID for each node',
|
||||||
|
`uid` varchar(45) DEFAULT NULL,
|
||||||
|
`status` int(11) NOT NULL DEFAULT 0,
|
||||||
|
`createdAt` datetime DEFAULT NULL,
|
||||||
|
`updatedAt` datetime DEFAULT NULL,
|
||||||
|
`signature` varchar(32) NOT NULL,
|
||||||
|
`revision` varchar(45) NOT NULL,
|
||||||
|
`permissions` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `id_UNIQUE` (`id`),
|
||||||
|
UNIQUE KEY `index2` (`uid`),
|
||||||
|
KEY `index3` (`signature`,`uid`,`revision`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `template.database.properties` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Primary Key',
|
||||||
|
`documentUid` varchar(45) NOT NULL COMMENT 'Unique UID foreign key',
|
||||||
|
`documentRevision` varchar(45) NOT NULL,
|
||||||
|
`key` varchar(32) NOT NULL COMMENT 'Property key name',
|
||||||
|
`value` text NOT NULL COMMENT 'Value of property',
|
||||||
|
`primitive` varchar(32) NOT NULL COMMENT 'Primitive type of property value',
|
||||||
|
`array` tinyint(4) NOT NULL DEFAULT 0,
|
||||||
|
`order` int(11) NOT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `index1` (`documentUid`),
|
||||||
|
KEY `index2` (`key`,`value`(5)),
|
||||||
|
FULLTEXT KEY `index3` (`value`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `template.database.relationships` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`revision` varchar(45) NOT NULL,
|
||||||
|
`start` varchar(45) NOT NULL COMMENT 'Unique UID foreign key',
|
||||||
|
`end` varchar(45) NOT NULL COMMENT 'Unique UID foreign key',
|
||||||
|
`key` varchar(256) NOT NULL,
|
||||||
|
`path` int(11) NOT NULL DEFAULT 0,
|
||||||
|
`array` tinyint(4) NOT NULL DEFAULT 0,
|
||||||
|
`order` int(11) NOT NULL DEFAULT 0,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `relationships_start_nodes_id_idx` (`start`),
|
||||||
|
KEY `relationships_end_nodes_id_idx` (`end`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
|
/* Default App */
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `app_console.database.documents` LIKE `template.database.documents`;
|
||||||
|
CREATE TABLE IF NOT EXISTS `app_console.database.properties` LIKE `template.database.properties`;
|
||||||
|
CREATE TABLE IF NOT EXISTS `app_console.database.relationships` LIKE `template.database.relationships`;
|
||||||
|
CREATE TABLE IF NOT EXISTS `app_console.audit.audit` LIKE `template.audit.audit`;
|
||||||
|
CREATE TABLE IF NOT EXISTS `app_console.abuse.abuse` LIKE `template.abuse.abuse`;
|
Loading…
Reference in a new issue