Pass database to migrations

This commit is contained in:
osaajani 2019-12-06 13:42:24 +01:00
parent 0edcaf3f69
commit fd436d6b80
4 changed files with 1615 additions and 246 deletions

View File

@ -4,6 +4,9 @@
"ajani/flash-message": "^2.0",
"giggsey/libphonenumber-for-php": "^8.10",
"twig/twig": "^3.0",
"symfony/expression-language": "^5.0"
"symfony/expression-language": "^5.0",
"robmorgan/phinx": "^0.11.1"
},
"require-dev": {
}
}

798
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "5c471b1b5ba3135917d74c53558a6259",
"content-hash": "33914b1a0dd7fc84bdff76a4d2cc51a7",
"packages": [
{
"name": "ajani/flash-message",
@ -42,6 +42,342 @@
"description": "A simple package to allow usage of flash messages using session.",
"time": "2019-11-09T02:11:30+00:00"
},
{
"name": "cakephp/cache",
"version": "3.8.6",
"source": {
"type": "git",
"url": "https://github.com/cakephp/cache.git",
"reference": "aa5c17495b23d843ba33bd81108e2031c38338c1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/cakephp/cache/zipball/aa5c17495b23d843ba33bd81108e2031c38338c1",
"reference": "aa5c17495b23d843ba33bd81108e2031c38338c1",
"shasum": ""
},
"require": {
"cakephp/core": "^3.6.0",
"php": ">=5.6.0",
"psr/simple-cache": "^1.0.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Cake\\Cache\\": "."
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "CakePHP Community",
"homepage": "https://github.com/cakephp/cache/graphs/contributors"
}
],
"description": "Easy to use Caching library with support for multiple caching backends",
"homepage": "https://cakephp.org",
"keywords": [
"cache",
"caching",
"cakephp"
],
"time": "2019-10-30T04:06:05+00:00"
},
{
"name": "cakephp/collection",
"version": "3.8.6",
"source": {
"type": "git",
"url": "https://github.com/cakephp/collection.git",
"reference": "1f15659671fbbd46d4a48b19bb8fac3ae4857cc1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/cakephp/collection/zipball/1f15659671fbbd46d4a48b19bb8fac3ae4857cc1",
"reference": "1f15659671fbbd46d4a48b19bb8fac3ae4857cc1",
"shasum": ""
},
"require": {
"php": ">=5.6.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Cake\\Collection\\": "."
},
"files": [
"functions.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "CakePHP Community",
"homepage": "https://github.com/cakephp/collection/graphs/contributors"
}
],
"description": "Work easily with arrays and iterators by having a battery of utility traversal methods",
"homepage": "https://cakephp.org",
"keywords": [
"arrays",
"cakephp",
"collections",
"iterators"
],
"time": "2019-10-30T04:06:05+00:00"
},
{
"name": "cakephp/core",
"version": "3.8.6",
"source": {
"type": "git",
"url": "https://github.com/cakephp/core.git",
"reference": "890cd8a00e1f2eb512cbe05e1c470a9eb6b2d9dd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/cakephp/core/zipball/890cd8a00e1f2eb512cbe05e1c470a9eb6b2d9dd",
"reference": "890cd8a00e1f2eb512cbe05e1c470a9eb6b2d9dd",
"shasum": ""
},
"require": {
"cakephp/utility": "^3.6.0",
"php": ">=5.6.0"
},
"suggest": {
"cakephp/cache": "To use Configure::store() and restore().",
"cakephp/event": "To use PluginApplicationInterface or plugin applications."
},
"type": "library",
"autoload": {
"psr-4": {
"Cake\\Core\\": "."
},
"files": [
"functions.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "CakePHP Community",
"homepage": "https://github.com/cakephp/core/graphs/contributors"
}
],
"description": "CakePHP Framework Core classes",
"homepage": "https://cakephp.org",
"keywords": [
"cakephp",
"core",
"framework"
],
"time": "2019-10-30T04:06:05+00:00"
},
{
"name": "cakephp/database",
"version": "3.8.6",
"source": {
"type": "git",
"url": "https://github.com/cakephp/database.git",
"reference": "d72f7f68efa1f85b982c60edd6fbefbd41d84e7b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/cakephp/database/zipball/d72f7f68efa1f85b982c60edd6fbefbd41d84e7b",
"reference": "d72f7f68efa1f85b982c60edd6fbefbd41d84e7b",
"shasum": ""
},
"require": {
"cakephp/cache": "^3.6.0",
"cakephp/core": "^3.6.0",
"cakephp/datasource": "^3.6.0",
"cakephp/log": "^3.6.0",
"php": ">=5.6.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Cake\\Database\\": "."
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "CakePHP Community",
"homepage": "https://github.com/cakephp/database/graphs/contributors"
}
],
"description": "Flexible and powerful Database abstraction library with a familiar PDO-like API",
"homepage": "https://cakephp.org",
"keywords": [
"abstraction",
"cakephp",
"database",
"database abstraction",
"pdo"
],
"time": "2019-10-21T08:26:32+00:00"
},
{
"name": "cakephp/datasource",
"version": "3.8.6",
"source": {
"type": "git",
"url": "https://github.com/cakephp/datasource.git",
"reference": "a9e63837df711d5ad19bf1eeeefe390218116d65"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/cakephp/datasource/zipball/a9e63837df711d5ad19bf1eeeefe390218116d65",
"reference": "a9e63837df711d5ad19bf1eeeefe390218116d65",
"shasum": ""
},
"require": {
"cakephp/core": "^3.6.0",
"php": ">=5.6.0"
},
"suggest": {
"cakephp/cache": "If you decide to use Query caching.",
"cakephp/collection": "If you decide to use ResultSetInterface.",
"cakephp/utility": "If you decide to use EntityTrait."
},
"type": "library",
"autoload": {
"psr-4": {
"Cake\\Datasource\\": "."
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "CakePHP Community",
"homepage": "https://github.com/cakephp/datasource/graphs/contributors"
}
],
"description": "Provides connection managing and traits for Entities and Queries that can be reused for different datastores",
"homepage": "https://cakephp.org",
"keywords": [
"cakephp",
"connection management",
"datasource",
"entity",
"query"
],
"time": "2019-10-30T09:41:00+00:00"
},
{
"name": "cakephp/log",
"version": "3.8.6",
"source": {
"type": "git",
"url": "https://github.com/cakephp/log.git",
"reference": "726495fab14a0beea38a2a40cabf8fca018aacef"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/cakephp/log/zipball/726495fab14a0beea38a2a40cabf8fca018aacef",
"reference": "726495fab14a0beea38a2a40cabf8fca018aacef",
"shasum": ""
},
"require": {
"cakephp/core": "^3.6.0",
"php": ">=5.6.0",
"psr/log": "^1.0.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Cake\\Log\\": "."
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "CakePHP Community",
"homepage": "https://github.com/cakephp/log/graphs/contributors"
}
],
"description": "CakePHP logging library with support for multiple different streams",
"homepage": "https://cakephp.org",
"keywords": [
"Streams",
"cakephp",
"log",
"logging"
],
"time": "2019-10-30T04:06:05+00:00"
},
{
"name": "cakephp/utility",
"version": "3.8.6",
"source": {
"type": "git",
"url": "https://github.com/cakephp/utility.git",
"reference": "de3288dd74119e120c36576db33f401ec8e9549e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/cakephp/utility/zipball/de3288dd74119e120c36576db33f401ec8e9549e",
"reference": "de3288dd74119e120c36576db33f401ec8e9549e",
"shasum": ""
},
"require": {
"cakephp/core": "^3.6.0",
"php": ">=5.6.0"
},
"suggest": {
"ext-intl": "To use Text::transliterate() or Text::slug()",
"lib-ICU": "To use Text::transliterate() or Text::slug()"
},
"type": "library",
"autoload": {
"psr-4": {
"Cake\\Utility\\": "."
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "CakePHP Community",
"homepage": "https://github.com/cakephp/utility/graphs/contributors"
}
],
"description": "CakePHP Utility classes such as Inflector, String, Hash, and Security",
"homepage": "https://cakephp.org",
"keywords": [
"cakephp",
"hash",
"inflector",
"security",
"string",
"utility"
],
"time": "2019-10-30T04:06:05+00:00"
},
{
"name": "giggsey/libphonenumber-for-php",
"version": "8.10.22",
@ -354,6 +690,131 @@
],
"time": "2019-11-01T11:05:21+00:00"
},
{
"name": "psr/simple-cache",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/simple-cache.git",
"reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
"reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\SimpleCache\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interfaces for simple caching",
"keywords": [
"cache",
"caching",
"psr",
"psr-16",
"simple-cache"
],
"time": "2017-10-23T01:57:42+00:00"
},
{
"name": "robmorgan/phinx",
"version": "0.11.1",
"source": {
"type": "git",
"url": "https://github.com/cakephp/phinx.git",
"reference": "a6cced878695d26396b26dfd62ce300aea07de05"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/cakephp/phinx/zipball/a6cced878695d26396b26dfd62ce300aea07de05",
"reference": "a6cced878695d26396b26dfd62ce300aea07de05",
"shasum": ""
},
"require": {
"cakephp/collection": "^3.6",
"cakephp/core": "^3.6",
"cakephp/database": "^3.6",
"cakephp/datasource": "^3.6",
"php": ">=5.6",
"symfony/config": "^3.4|^4.0",
"symfony/console": "^3.4|^4.0",
"symfony/yaml": "^3.4|^4.0"
},
"require-dev": {
"cakephp/cakephp-codesniffer": "^3.0",
"phpunit/phpunit": ">=5.7,<8.0",
"sebastian/comparator": ">=1.2.3"
},
"bin": [
"bin/phinx"
],
"type": "library",
"autoload": {
"psr-4": {
"Phinx\\": "src/Phinx/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Rob Morgan",
"email": "robbym@gmail.com",
"homepage": "https://robmorgan.id.au",
"role": "Lead Developer"
},
{
"name": "Woody Gilk",
"email": "woody.gilk@gmail.com",
"homepage": "https://shadowhand.me",
"role": "Developer"
},
{
"name": "Richard Quadling",
"email": "rquadling@gmail.com",
"role": "Developer"
},
{
"name": "CakePHP Community",
"homepage": "https://github.com/cakephp/phinx/graphs/contributors",
"role": "Developer"
}
],
"description": "Phinx makes it ridiculously easy to manage the database migrations for your PHP app.",
"homepage": "https://phinx.org",
"keywords": [
"database",
"database migrations",
"db",
"migrations",
"phinx"
],
"time": "2019-08-28T12:24:19+00:00"
},
{
"name": "symfony/cache",
"version": "v5.0.0",
@ -491,6 +952,146 @@
],
"time": "2019-11-09T09:18:34+00:00"
},
{
"name": "symfony/config",
"version": "v4.4.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/config.git",
"reference": "7aa5817f1b7a8ed377752b90fcc47dfb3c67b40c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/config/zipball/7aa5817f1b7a8ed377752b90fcc47dfb3c67b40c",
"reference": "7aa5817f1b7a8ed377752b90fcc47dfb3c67b40c",
"shasum": ""
},
"require": {
"php": "^7.1.3",
"symfony/filesystem": "^3.4|^4.0|^5.0",
"symfony/polyfill-ctype": "~1.8"
},
"conflict": {
"symfony/finder": "<3.4"
},
"require-dev": {
"symfony/event-dispatcher": "^3.4|^4.0|^5.0",
"symfony/finder": "^3.4|^4.0|^5.0",
"symfony/messenger": "^4.1|^5.0",
"symfony/service-contracts": "^1.1|^2",
"symfony/yaml": "^3.4|^4.0|^5.0"
},
"suggest": {
"symfony/yaml": "To use the yaml reference dumper"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.4-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Config\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Config Component",
"homepage": "https://symfony.com",
"time": "2019-12-01T10:50:45+00:00"
},
{
"name": "symfony/console",
"version": "v4.4.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "f0aea3df20d15635b3cb9730ca5eea1c65b7f201"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/f0aea3df20d15635b3cb9730ca5eea1c65b7f201",
"reference": "f0aea3df20d15635b3cb9730ca5eea1c65b7f201",
"shasum": ""
},
"require": {
"php": "^7.1.3",
"symfony/polyfill-mbstring": "~1.0",
"symfony/polyfill-php73": "^1.8",
"symfony/service-contracts": "^1.1|^2"
},
"conflict": {
"symfony/dependency-injection": "<3.4",
"symfony/event-dispatcher": "<4.3|>=5",
"symfony/lock": "<4.4",
"symfony/process": "<3.3"
},
"provide": {
"psr/log-implementation": "1.0"
},
"require-dev": {
"psr/log": "~1.0",
"symfony/config": "^3.4|^4.0|^5.0",
"symfony/dependency-injection": "^3.4|^4.0|^5.0",
"symfony/event-dispatcher": "^4.3",
"symfony/lock": "^4.4|^5.0",
"symfony/process": "^3.4|^4.0|^5.0",
"symfony/var-dumper": "^4.3|^5.0"
},
"suggest": {
"psr/log": "For using the console logger",
"symfony/event-dispatcher": "",
"symfony/lock": "",
"symfony/process": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.4-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Console\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"time": "2019-12-01T10:06:17+00:00"
},
{
"name": "symfony/expression-language",
"version": "v5.0.0",
@ -542,6 +1143,56 @@
"homepage": "https://symfony.com",
"time": "2019-11-18T17:27:11+00:00"
},
{
"name": "symfony/filesystem",
"version": "v5.0.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
"reference": "1d71f670bc5a07b9ccc97dc44f932177a322d4e6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/1d71f670bc5a07b9ccc97dc44f932177a322d4e6",
"reference": "1d71f670bc5a07b9ccc97dc44f932177a322d4e6",
"shasum": ""
},
"require": {
"php": "^7.2.5",
"symfony/polyfill-ctype": "~1.8"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.0-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Filesystem\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Filesystem Component",
"homepage": "https://symfony.com",
"time": "2019-11-26T23:25:11+00:00"
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.12.0",
@ -602,16 +1253,16 @@
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.12.0",
"version": "v1.13.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17"
"reference": "7b4aab9743c30be783b73de055d24a39cf4b954f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/b42a2f66e8f1b15ccf25652c3424265923eb4f17",
"reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f",
"reference": "7b4aab9743c30be783b73de055d24a39cf4b954f",
"shasum": ""
},
"require": {
@ -623,7 +1274,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.12-dev"
"dev-master": "1.13-dev"
}
},
"autoload": {
@ -657,24 +1308,82 @@
"portable",
"shim"
],
"time": "2019-08-06T08:03:45+00:00"
"time": "2019-11-27T14:18:11+00:00"
},
{
"name": "symfony/service-contracts",
"version": "v2.0.0",
"name": "symfony/polyfill-php73",
"version": "v1.13.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/service-contracts.git",
"reference": "9d99e1556417bf227a62e14856d630672bf10eaf"
"url": "https://github.com/symfony/polyfill-php73.git",
"reference": "4b0e2222c55a25b4541305a053013d5647d3a25f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/9d99e1556417bf227a62e14856d630672bf10eaf",
"reference": "9d99e1556417bf227a62e14856d630672bf10eaf",
"url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/4b0e2222c55a25b4541305a053013d5647d3a25f",
"reference": "4b0e2222c55a25b4541305a053013d5647d3a25f",
"shasum": ""
},
"require": {
"php": "^7.2.9",
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.13-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php73\\": ""
},
"files": [
"bootstrap.php"
],
"classmap": [
"Resources/stubs"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"time": "2019-11-27T16:25:15+00:00"
},
{
"name": "symfony/service-contracts",
"version": "v2.0.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/service-contracts.git",
"reference": "144c5e51266b281231e947b51223ba14acf1a749"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/144c5e51266b281231e947b51223ba14acf1a749",
"reference": "144c5e51266b281231e947b51223ba14acf1a749",
"shasum": ""
},
"require": {
"php": "^7.2.5",
"psr/container": "^1.0"
},
"suggest": {
@ -715,7 +1424,7 @@
"interoperability",
"standards"
],
"time": "2019-11-09T09:18:34+00:00"
"time": "2019-11-18T17:27:11+00:00"
},
{
"name": "symfony/var-exporter",
@ -777,6 +1486,65 @@
],
"time": "2019-11-18T17:27:11+00:00"
},
{
"name": "symfony/yaml",
"version": "v4.4.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "76de473358fe802578a415d5bb43c296cf09d211"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/76de473358fe802578a415d5bb43c296cf09d211",
"reference": "76de473358fe802578a415d5bb43c296cf09d211",
"shasum": ""
},
"require": {
"php": "^7.1.3",
"symfony/polyfill-ctype": "~1.8"
},
"conflict": {
"symfony/console": "<3.4"
},
"require-dev": {
"symfony/console": "^3.4|^4.0|^5.0"
},
"suggest": {
"symfony/console": "For validating YAML files using the lint command"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.4-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Yaml\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"time": "2019-11-12T14:51:11+00:00"
},
{
"name": "twig/twig",
"version": "v3.0.0",

View File

@ -1,230 +0,0 @@
#Ce fichier contient la base de données à créer
CREATE DATABASE IF NOT EXISTS raspisms;
USE raspisms;
CREATE TABLE IF NOT EXISTS user
(
id INT NOT NULL AUTO_INCREMENT,
email VARCHAR(150) NOT NULL,
password VARCHAR(255) NOT NULL,
admin BOOLEAN NOT NULL DEFAULT FALSE,
transfer BOOLEAN NOT NULL DEFAULT FALSE,
PRIMARY KEY (id),
UNIQUE (email)
);
CREATE TABLE IF NOT EXISTS setting
(
id INT NOT NULL AUTO_INCREMENT,
id_user INT NOT NULL,
name VARCHAR(50) NOT NULL,
value VARCHAR(1000) NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (id_user) REFERENCES user (id) ON DELETE CASCADE ON UPDATE CASCADE,
UNIQUE (id_user, name)
);
CREATE TABLE IF NOT EXISTS scheduled
(
id INT NOT NULL AUTO_INCREMENT,
id_user INT NOT NULL,
origin VARCHAR(25) DEFAULT NULL,
at DATETIME NOT NULL,
text VARCHAR(1000) NOT NULL,
flash BOOLEAN NOT NULL DEFAULT 0,
FOREIGN KEY (id_user) REFERENCES user (id) ON DELETE CASCADE ON UPDATE CASCADE,
PRIMARY KEY (id)
);
CREATE TABLE IF NOT EXISTS media
(
id INT NOT NULL AUTO_INCREMENT,
id_scheduled INT NOT NULL,
path VARCHAR(1000) NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (id_scheduled) REFERENCES scheduled (id) ON DELETE CASCADE ON UPDATE CASCADE,
UNIQUE (id_scheduled)
);
CREATE TABLE IF NOT EXISTS received
(
id INT NOT NULL AUTO_INCREMENT,
at DATETIME NOT NULL,
text VARCHAR(1000) NOT NULL,
origin VARCHAR(20) NOT NULL,
destination VARCHAR(20),
command BOOLEAN NOT NULL DEFAULT 0,
status ENUM('read', 'unread') NOT NULL DEFAULT 'unread',
PRIMARY KEY (id)
);
CREATE TABLE IF NOT EXISTS sended
(
id INT NOT NULL AUTO_INCREMENT,
at DATETIME NOT NULL,
text VARCHAR(1000) NOT NULL,
origin VARCHAR(20) NOT NULL,
destination VARCHAR(20),
flash BOOLEAN NOT NULL DEFAULT 0,
status ENUM('unknown', 'delivered', 'failed') NOT NULL DEFAULT 'unknown',
PRIMARY KEY (id)
);
CREATE TABLE IF NOT EXISTS contact
(
id INT NOT NULL AUTO_INCREMENT,
id_user INT NOT NULL,
name VARCHAR(100) NOT NULL,
number VARCHAR(20) NOT NULL,
datas TEXT NOT NULL,
CHECK (JSON_VALID(datas)),
PRIMARY KEY (id),
FOREIGN KEY (id_user) REFERENCES user (id) ON DELETE CASCADE ON UPDATE CASCADE,
UNIQUE (id_user, name)
);
CREATE TABLE IF NOT EXISTS `group`
(
id INT NOT NULL AUTO_INCREMENT,
id_user INT NOT NULL,
name VARCHAR(100) NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (id_user) REFERENCES user (id) ON DELETE CASCADE ON UPDATE CASCADE,
UNIQUE (id_user, name)
);
CREATE TABLE IF NOT EXISTS `conditional_group`
(
id INT NOT NULL AUTO_INCREMENT,
id_user INT NOT NULL,
name VARCHAR(100) NOT NULL,
`condition` TEXT NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (id_user) REFERENCES user (id) ON DELETE CASCADE ON UPDATE CASCADE,
UNIQUE (id_user, name)
);
CREATE TABLE IF NOT EXISTS group_contact
(
id INT NOT NULL AUTO_INCREMENT,
id_group INT NOT NULL,
id_contact INT NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (id_group) REFERENCES `group` (id) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (id_contact) REFERENCES contact (id) ON DELETE CASCADE ON UPDATE CASCADE
);
CREATE TABLE IF NOT EXISTS scheduled_contact
(
id INT NOT NULL AUTO_INCREMENT,
id_scheduled INT NOT NULL,
id_contact INT NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (id_scheduled) REFERENCES scheduled (id) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (id_contact) REFERENCES contact (id) ON DELETE CASCADE ON UPDATE CASCADE
);
CREATE TABLE IF NOT EXISTS scheduled_group
(
id INT NOT NULL AUTO_INCREMENT,
id_scheduled INT NOT NULL,
id_group INT NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (id_scheduled) REFERENCES scheduled (id) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (id_group) REFERENCES `group` (id) ON DELETE CASCADE ON UPDATE CASCADE
);
CREATE TABLE IF NOT EXISTS scheduled_conditional_group
(
id INT NOT NULL AUTO_INCREMENT,
id_scheduled INT NOT NULL,
id_conditional_group INT NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (id_scheduled) REFERENCES scheduled (id) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (id_conditional_group) REFERENCES `conditional_group` (id) ON DELETE CASCADE ON UPDATE CASCADE
);
CREATE TABLE IF NOT EXISTS scheduled_number
(
id INT NOT NULL AUTO_INCREMENT,
id_scheduled INT NOT NULL,
number VARCHAR(20) NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (id_scheduled) REFERENCES scheduled (id) ON DELETE CASCADE ON UPDATE CASCADE
);
CREATE TABLE IF NOT EXISTS command
(
id INT NOT NULL AUTO_INCREMENT,
id_user INT NOT NULL,
name VARCHAR(25) NOT NULL,
script VARCHAR(100) NOT NULL,
admin BOOLEAN NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (id_user) REFERENCES user (id) ON DELETE CASCADE ON UPDATE CASCADE,
UNIQUE (id_user, name)
);
CREATE TABLE IF NOT EXISTS event
(
id INT NOT NULL AUTO_INCREMENT,
id_user INT NOT NULL,
type VARCHAR(25) NOT NULL,
at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
text VARCHAR(255) NOT NULL,
FOREIGN KEY (id_user) REFERENCES user (id) ON DELETE CASCADE ON UPDATE CASCADE,
PRIMARY KEY (id)
);
CREATE TABLE IF NOT EXISTS phone
(
id INT NOT NULL AUTO_INCREMENT,
id_user INT NOT NULL,
number VARCHAR(25) NOT NULL,
adapter VARCHAR(100) NOT NULL,
adapter_datas TEXT DEFAULT NULL,
CHECK (JSON_VALID(adapter_datas)),
PRIMARY KEY (id),
FOREIGN KEY (id_user) REFERENCES user (id) ON DELETE CASCADE ON UPDATE CASCADE
);
#Table to ensure external validation process by mailing or other
CREATE TABLE IF NOT EXISTS validation
(
id INT NOT NULL AUTO_INCREMENT,
token VARCHAR(200) NOT NULL,
random VARCHAR(32) NOT NULL,
action VARCHAR(200) NOT NULL,
datas TEXT NOT NULL,
CHECK (JSON_VALID(datas)),
PRIMARY KEY (id)
);
CREATE TABLE IF NOT EXISTS smsstop
(
id INT NOT NULL AUTO_INCREMENT,
id_user INT NOT NULL,
number VARCHAR(20) NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (id_user) REFERENCES user (id) ON DELETE CASCADE ON UPDATE CASCADE,
UNIQUE (id_user, number)
);
CREATE TABLE IF NOT EXISTS webhook
(
id INT NOT NULL AUTO_INCREMENT,
id_user INT NOT NULL,
url VARCHAR(250) NOT NULL,
type ENUM('send_sms', 'receive_sms') NOT NULL,
FOREIGN KEY (id_user) REFERENCES user (id) ON DELETE CASCADE ON UPDATE CASCADE,
PRIMARY KEY (id)
);
CREATE TABLE IF NOT EXISTS webhook_querie
(
id INT NOT NULL AUTO_INCREMENT,
url VARCHAR(250) NOT NULL,
datas VARCHAR(10000) NOT NULL,
PRIMARY KEY (id)
);

View File

@ -0,0 +1,828 @@
<?php
use Phinx\Db\Adapter\MysqlAdapter;
class FirstMigration extends Phinx\Migration\AbstractMigration
{
public function change()
{
$this->execute("ALTER DATABASE CHARACTER SET 'utf8mb4';");
$this->execute("ALTER DATABASE COLLATE='utf8mb4_general_ci';");
$this->table('command', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'COMPACT',
])
->addColumn('id', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'identity' => 'enable',
])
->addColumn('id_user', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'id',
])
->addColumn('name', 'string', [
'null' => false,
'limit' => 25,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id_user',
])
->addColumn('script', 'string', [
'null' => false,
'limit' => 100,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'name',
])
->addColumn('admin', 'boolean', [
'null' => false,
'limit' => MysqlAdapter::INT_TINY,
'after' => 'script',
])
->addIndex(['id_user', 'name'], [
'name' => 'id_user',
'unique' => true,
])
->create();
$this->table('conditional_group', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'COMPACT',
])
->addColumn('id', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'identity' => 'enable',
])
->addColumn('id_user', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'id',
])
->addColumn('name', 'string', [
'null' => false,
'limit' => 100,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id_user',
])
->addColumn('condition', 'text', [
'null' => false,
'limit' => 65535,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'name',
])
->addIndex(['id_user', 'name'], [
'name' => 'id_user',
'unique' => true,
])
->create();
$this->table('contact', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'COMPACT',
])
->addColumn('id', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'identity' => 'enable',
])
->addColumn('id_user', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'id',
])
->addColumn('name', 'string', [
'null' => false,
'limit' => 100,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id_user',
])
->addColumn('number', 'string', [
'null' => false,
'limit' => 20,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'name',
])
->addColumn('datas', 'text', [
'null' => true,
'limit' => 65535,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'number',
])
->addIndex(['id_user', 'name'], [
'name' => 'id_user',
'unique' => true,
])
->create();
$this->table('event', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'COMPACT',
])
->addColumn('id', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'identity' => 'enable',
])
->addColumn('id_user', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'id',
])
->addColumn('type', 'string', [
'null' => false,
'limit' => 25,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id_user',
])
->addColumn('at', 'timestamp', [
'null' => false,
'default' => 'CURRENT_TIMESTAMP',
'after' => 'type',
])
->addColumn('text', 'string', [
'null' => false,
'limit' => 255,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'at',
])
->addIndex(['id_user'], [
'name' => 'id_user',
'unique' => false,
])
->create();
$this->table('group', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'COMPACT',
])
->addColumn('id', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'identity' => 'enable',
])
->addColumn('id_user', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'id',
])
->addColumn('name', 'string', [
'null' => false,
'limit' => 100,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id_user',
])
->addIndex(['id_user', 'name'], [
'name' => 'id_user',
'unique' => true,
])
->create();
$this->table('group_contact', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'COMPACT',
])
->addColumn('id', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'identity' => 'enable',
])
->addColumn('id_group', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'id',
])
->addColumn('id_contact', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'id_group',
])
->addIndex(['id_group'], [
'name' => 'id_group',
'unique' => false,
])
->addIndex(['id_contact'], [
'name' => 'id_contact',
'unique' => false,
])
->create();
$this->table('media', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'COMPACT',
])
->addColumn('id', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'identity' => 'enable',
])
->addColumn('id_scheduled', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'id',
])
->addColumn('path', 'string', [
'null' => false,
'limit' => 1000,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id_scheduled',
])
->addIndex(['id_scheduled'], [
'name' => 'id_scheduled',
'unique' => false,
])
->create();
$this->table('phone', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'COMPACT',
])
->addColumn('id', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'identity' => 'enable',
])
->addColumn('id_user', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'id',
])
->addColumn('number', 'string', [
'null' => false,
'limit' => 25,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id_user',
])
->addColumn('adapter', 'string', [
'null' => false,
'limit' => 100,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'number',
])
->addColumn('adapter_datas', 'text', [
'null' => true,
'limit' => 65535,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'adapter',
])
->addIndex(['id_user'], [
'name' => 'id_user',
'unique' => false,
])
->create();
$this->table('received', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'COMPACT',
])
->addColumn('id', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'identity' => 'enable',
])
->addColumn('at', 'datetime', [
'null' => false,
'after' => 'id',
])
->addColumn('text', 'string', [
'null' => false,
'limit' => 1000,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'at',
])
->addColumn('origin', 'string', [
'null' => false,
'limit' => 20,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'text',
])
->addColumn('destination', 'string', [
'null' => true,
'limit' => 20,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'origin',
])
->addColumn('command', 'boolean', [
'null' => false,
'default' => '0',
'limit' => MysqlAdapter::INT_TINY,
'after' => 'destination',
])
->addColumn('status', 'enum', [
'null' => false,
'default' => 'unread',
'limit' => 6,
'values' => ['read', 'unread'],
'after' => 'command',
])
->create();
$this->table('scheduled', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'COMPACT',
])
->addColumn('id', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'identity' => 'enable',
])
->addColumn('id_user', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'id',
])
->addColumn('origin', 'string', [
'null' => true,
'limit' => 25,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id_user',
])
->addColumn('at', 'datetime', [
'null' => false,
'after' => 'origin',
])
->addColumn('text', 'string', [
'null' => false,
'limit' => 1000,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'at',
])
->addColumn('flash', 'boolean', [
'null' => false,
'default' => '0',
'limit' => MysqlAdapter::INT_TINY,
'after' => 'text',
])
->addIndex(['id_user'], [
'name' => 'id_user',
'unique' => false,
])
->create();
$this->table('scheduled_conditional_group', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'COMPACT',
])
->addColumn('id', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'identity' => 'enable',
])
->addColumn('id_scheduled', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'id',
])
->addColumn('id_conditional_group', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'id_scheduled',
])
->addIndex(['id_scheduled'], [
'name' => 'id_scheduled',
'unique' => false,
])
->addIndex(['id_conditional_group'], [
'name' => 'id_conditional_group',
'unique' => false,
])
->create();
$this->table('scheduled_contact', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'COMPACT',
])
->addColumn('id', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'identity' => 'enable',
])
->addColumn('id_scheduled', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'id',
])
->addColumn('id_contact', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'id_scheduled',
])
->addIndex(['id_scheduled'], [
'name' => 'id_scheduled',
'unique' => false,
])
->addIndex(['id_contact'], [
'name' => 'id_contact',
'unique' => false,
])
->create();
$this->table('scheduled_group', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'COMPACT',
])
->addColumn('id', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'identity' => 'enable',
])
->addColumn('id_scheduled', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'id',
])
->addColumn('id_group', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'id_scheduled',
])
->addIndex(['id_scheduled'], [
'name' => 'id_scheduled',
'unique' => false,
])
->addIndex(['id_group'], [
'name' => 'id_group',
'unique' => false,
])
->create();
$this->table('scheduled_number', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'COMPACT',
])
->addColumn('id', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'identity' => 'enable',
])
->addColumn('id_scheduled', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'id',
])
->addColumn('number', 'string', [
'null' => false,
'limit' => 20,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id_scheduled',
])
->addIndex(['id_scheduled'], [
'name' => 'id_scheduled',
'unique' => false,
])
->create();
$this->table('sended', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'COMPACT',
])
->addColumn('id', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'identity' => 'enable',
])
->addColumn('at', 'datetime', [
'null' => false,
'after' => 'id',
])
->addColumn('text', 'string', [
'null' => false,
'limit' => 1000,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'at',
])
->addColumn('origin', 'string', [
'null' => false,
'limit' => 20,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'text',
])
->addColumn('destination', 'string', [
'null' => true,
'limit' => 20,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'origin',
])
->addColumn('flash', 'boolean', [
'null' => false,
'default' => '0',
'limit' => MysqlAdapter::INT_TINY,
'after' => 'destination',
])
->addColumn('status', 'enum', [
'null' => false,
'default' => 'unknown',
'limit' => 9,
'values' => ['unknown', 'delivered', 'failed'],
'after' => 'flash',
])
->create();
$this->table('setting', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'COMPACT',
])
->addColumn('id', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'identity' => 'enable',
])
->addColumn('id_user', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'id',
])
->addColumn('name', 'string', [
'null' => false,
'limit' => 50,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id_user',
])
->addColumn('value', 'string', [
'null' => false,
'limit' => 1000,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'name',
])
->addIndex(['id_user', 'name'], [
'name' => 'id_user',
'unique' => true,
])
->create();
$this->table('smsstop', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'COMPACT',
])
->addColumn('id', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'identity' => 'enable',
])
->addColumn('id_user', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'id',
])
->addColumn('number', 'string', [
'null' => false,
'limit' => 20,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id_user',
])
->addIndex(['id_user', 'number'], [
'name' => 'id_user',
'unique' => true,
])
->create();
$this->table('user', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'COMPACT',
])
->addColumn('id', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'identity' => 'enable',
])
->addColumn('email', 'string', [
'null' => false,
'limit' => 150,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id',
])
->addColumn('password', 'string', [
'null' => false,
'limit' => 255,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'email',
])
->addColumn('admin', 'boolean', [
'null' => false,
'default' => '0',
'limit' => MysqlAdapter::INT_TINY,
'after' => 'password',
])
->addColumn('transfer', 'boolean', [
'null' => false,
'default' => '0',
'limit' => MysqlAdapter::INT_TINY,
'after' => 'admin',
])
->addIndex(['email'], [
'name' => 'email',
'unique' => true,
])
->create();
$this->table('validation', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'COMPACT',
])
->addColumn('id', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'identity' => 'enable',
])
->addColumn('token', 'string', [
'null' => false,
'limit' => 200,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id',
])
->addColumn('random', 'string', [
'null' => false,
'limit' => 32,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'token',
])
->addColumn('action', 'string', [
'null' => false,
'limit' => 200,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'random',
])
->addColumn('datas', 'text', [
'null' => false,
'limit' => 65535,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'action',
])
->create();
$this->table('webhook', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'COMPACT',
])
->addColumn('id', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'identity' => 'enable',
])
->addColumn('id_user', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'after' => 'id',
])
->addColumn('url', 'string', [
'null' => false,
'limit' => 250,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id_user',
])
->addColumn('type', 'enum', [
'null' => false,
'limit' => 11,
'values' => ['send_sms', 'receive_sms'],
'after' => 'url',
])
->addIndex(['id_user'], [
'name' => 'id_user',
'unique' => false,
])
->create();
$this->table('webhook_querie', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'COMPACT',
])
->addColumn('id', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'identity' => 'enable',
])
->addColumn('url', 'string', [
'null' => false,
'limit' => 250,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'id',
])
->addColumn('datas', 'string', [
'null' => false,
'limit' => 10000,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'after' => 'url',
])
->create();
}
}