├── .gitignore
├── config
├── users.json
├── sqlite
│ └── config.json
├── pg
│ ├── config.json
│ └── settings.json
├── mysql
│ └── config.json
└── custom.json
├── fixtures
├── x-admin-examples.mwb
├── sqlite
│ ├── import.js
│ ├── schema.sql
│ └── insert.sql
├── mysql
│ ├── insert.sql
│ └── schema.sql
└── pg
│ ├── insert.sql
│ └── schema.sql
├── custom
├── app3
│ ├── public
│ │ ├── css
│ │ │ └── local.css
│ │ └── js
│ │ │ └── local.js
│ ├── app.js
│ └── views
│ │ └── view.html
├── editors
│ ├── uploads
│ │ └── README.md
│ ├── jslib
│ │ └── README.md
│ ├── upload.html
│ ├── app.js
│ └── editors.js
├── app2
│ ├── public
│ │ ├── css
│ │ │ └── global.css
│ │ └── js
│ │ │ └── global.js
│ ├── app.js
│ └── views
│ │ └── view.html
├── app4
│ ├── views
│ │ └── view.html
│ └── app.js
├── static
│ ├── theme.js
│ ├── binary.js
│ ├── mtm-tags.js
│ └── images.js
├── app1
│ ├── app.js
│ └── view.html
├── highcharts
│ ├── views
│ │ ├── readme.html
│ │ └── form.html
│ ├── pie.js
│ └── app.js
└── events
│ └── events.js
├── .editorconfig
├── path.js
├── start.js
├── package.json
├── LICENSE
├── docker-compose.yml
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | package-lock.json
3 | npm-debug.log
4 | *.bak
5 | *.sqlite
6 |
--------------------------------------------------------------------------------
/config/users.json:
--------------------------------------------------------------------------------
1 | {
2 | "admin": {
3 | "name": "admin",
4 | "pass": "1234abCD"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/fixtures/x-admin-examples.mwb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simov/express-admin-examples/HEAD/fixtures/x-admin-examples.mwb
--------------------------------------------------------------------------------
/custom/app3/public/css/local.css:
--------------------------------------------------------------------------------
1 |
2 | #local-static-files p:first-child { color: blue; }
3 | #local-static-files p:last-child { color: purple; }
4 |
--------------------------------------------------------------------------------
/custom/editors/uploads/README.md:
--------------------------------------------------------------------------------
1 |
2 | You can upload images through `CKEditor's compact` instance.
3 |
4 | All images will be uploaded here.
5 |
--------------------------------------------------------------------------------
/custom/app2/public/css/global.css:
--------------------------------------------------------------------------------
1 |
2 | #global-static-files p:first-child { color: green; }
3 | #global-static-files p:last-child { color: red; }
4 |
--------------------------------------------------------------------------------
/custom/editors/jslib/README.md:
--------------------------------------------------------------------------------
1 |
2 | You should download [TinyMCE jQuery package](http://www.tinymce.com/download/download.php) and extract it here.
3 |
--------------------------------------------------------------------------------
/custom/app3/public/js/local.js:
--------------------------------------------------------------------------------
1 |
2 | $(function () {
3 | $('#local-static-files')
4 | .append('
I\'m added through custom local js file.
')
5 | })
6 |
--------------------------------------------------------------------------------
/custom/app2/public/js/global.js:
--------------------------------------------------------------------------------
1 |
2 | $(function () {
3 | $('#global-static-files')
4 | .append('I\'m added through custom global js file.
')
5 | })
6 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # editorconfig.org
2 | root = true
3 |
4 | [*]
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | charset = utf-8
9 | trim_trailing_whitespace = true
10 | insert_final_newline = true
11 |
--------------------------------------------------------------------------------
/config/sqlite/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "sqlite": {
3 | "database": "/home/git/express-admin-examples/fixtures/sqlite/x-admin-examples.sqlite"
4 | },
5 | "admin": {
6 | "settings": "/home/s/git/express-admin-examples/config/sqlite/settings.json"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/config/pg/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "pg": {
3 | "database": "x-admin-examples",
4 | "user": "postgres",
5 | "password": "x-admin",
6 | "port": 8234
7 | },
8 | "admin": {
9 | "settings": "/home/s/git/express-admin-examples/config/pg/settings.json"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/config/mysql/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "mysql": {
3 | "database": "x-admin-examples",
4 | "user": "root",
5 | "password": "x-admin",
6 | "port": 8123
7 | },
8 | "admin": {
9 | "settings": "/home/s/git/express-admin-examples/config/mysql/settings.json"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/custom/app4/views/view.html:
--------------------------------------------------------------------------------
1 |
2 | Breadcrumbs
3 |
4 | Using the built-in breadcrumbs partial
5 |
6 |
7 | The res.locals.breadcrumb variable can be used inside your custom view to configure and render the breadcrumbs partial above your custom view content.
8 |
9 |
--------------------------------------------------------------------------------
/custom/static/theme.js:
--------------------------------------------------------------------------------
1 |
2 | $(function () {
3 | // choose a theme that will be pre-selected by default
4 | var theme = 'Default' // Flatly, Cosmo ...
5 |
6 | // note that your default theme will be selected
7 | // only if the user have not chosen any other theme yet
8 | if (!window.localStorage.getItem('theme')) {
9 | $('#theme a:contains('+theme+')').trigger('click')
10 | }
11 | })
12 |
--------------------------------------------------------------------------------
/custom/static/binary.js:
--------------------------------------------------------------------------------
1 |
2 | $(function () {
3 | if (!$('.x-filter').length) return
4 | var index = $('.x-table th').index($('.x-table th:contains(binary)'))
5 | if (index != -1) {
6 | $('.x-table tr:gt(0)').each(function (idx) {
7 | var blob = $('td', this).eq(index)
8 | var base64 = blob.text()
9 |
10 | blob.html(' ')
11 | })
12 | }
13 | })
14 |
--------------------------------------------------------------------------------
/custom/app1/app.js:
--------------------------------------------------------------------------------
1 |
2 | var express = require('express')
3 | var app = module.exports = express()
4 | var path = require('path')
5 |
6 | app.set('views', __dirname)
7 |
8 | app.get('/view1', (req, res, next) => {
9 |
10 | var relative = path.relative(res.locals._admin.views, app.get('views'))
11 |
12 | res.locals.partials = {
13 | content: path.join(relative, 'view')
14 | }
15 |
16 | next()
17 | })
18 |
--------------------------------------------------------------------------------
/custom/highcharts/views/readme.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | This example features:
4 |
5 | multiple templates
6 | template partials
7 | selected elements in template
8 | post request
9 | csrf token
10 | reusing the database connection
11 | custom slugs
12 | highcharts
13 |
14 |
15 |
--------------------------------------------------------------------------------
/custom/app2/app.js:
--------------------------------------------------------------------------------
1 |
2 | var express = require('express')
3 | var app = module.exports = express()
4 | var path = require('path')
5 |
6 | app.set('views', path.join(__dirname, 'views'))
7 |
8 | app.get('/view2', (req, res, next) => {
9 |
10 | var relative = path.relative(res.locals._admin.views, app.get('views'))
11 |
12 | res.locals.partials = {
13 | content: path.join(relative, 'view')
14 | }
15 |
16 | next()
17 | })
18 |
--------------------------------------------------------------------------------
/custom/app3/app.js:
--------------------------------------------------------------------------------
1 |
2 | var express = require('express')
3 | var app = module.exports = express()
4 | var path = require('path')
5 |
6 | app.set('views', path.join(__dirname, 'views'))
7 |
8 | app.get('/view3', (req, res, next) => {
9 |
10 | var relative = path.relative(res.locals._admin.views, app.get('views'))
11 |
12 | res.locals.partials = {
13 | content: path.join(relative, 'view')
14 | }
15 |
16 | next()
17 | })
18 |
--------------------------------------------------------------------------------
/path.js:
--------------------------------------------------------------------------------
1 |
2 | var fs = require('fs')
3 | var path = require('path')
4 |
5 | ;[
6 | 'config/mysql/config.json',
7 | 'config/pg/config.json',
8 | 'config/sqlite/config.json',
9 | 'config/custom.json',
10 | ].forEach((file) => {
11 | var fpath = path.resolve(__dirname, file)
12 | fs.writeFileSync(
13 | fpath,
14 | fs.readFileSync(fpath, 'utf8')
15 | .replace(/\/home\/s\/git\/express-admin-examples/g, __dirname),
16 | 'utf8')
17 | })
18 |
--------------------------------------------------------------------------------
/custom/static/mtm-tags.js:
--------------------------------------------------------------------------------
1 |
2 | $(function () {
3 | // navigate to the Listview for the Controls table
4 | // note the different colors for each Many to Many label
5 |
6 | // set the background color for the Many to Many labels based on their content
7 | $('.x-table .label:contains("one two")').css({background: '#d43d3d'})
8 | $('.x-table .label:contains("three")').css({background: '#4654bb'})
9 | $('.x-table .label:contains("four five")').css({background: '#52b035'})
10 | })
11 |
--------------------------------------------------------------------------------
/start.js:
--------------------------------------------------------------------------------
1 |
2 | var express = require('express')
3 | var admin = require('express-admin')
4 |
5 | var name = process.argv[2]
6 |
7 | if (!name) {
8 | console.log('Specify database engine name to use: mysql, pg or sqlite')
9 | process.exit()
10 | }
11 |
12 | express()
13 | .use(admin({
14 | config: require(`./config/${name}/config.json`),
15 | settings: require(`./config/${name}/settings.json`),
16 | users: require(`./config/users.json`),
17 | custom: require(`./config/custom.json`),
18 | }))
19 | .listen(3000)
20 |
--------------------------------------------------------------------------------
/custom/app2/views/view.html:
--------------------------------------------------------------------------------
1 |
2 | Global Static Files
3 |
4 | Static files referenced inside the custom configuration
5 |
6 |
7 | Static css and js files defined in your custom configuration will be included inside the <head> tag of the page. They will be loaded always, even on views that do not need them.
8 |
9 |
10 |
11 |
I'm styled through custom global css file.
12 |
13 |
--------------------------------------------------------------------------------
/fixtures/sqlite/import.js:
--------------------------------------------------------------------------------
1 |
2 | var fs = require('fs')
3 | var path = require('path')
4 | var sqlite3 = require('sqlite3').verbose()
5 |
6 | var db = path.join(__dirname, 'x-admin-examples.sqlite')
7 | var schema = fs.readFileSync(path.join(__dirname, 'schema.sql'), 'utf8')
8 | var insert = fs.readFileSync(path.join(__dirname, 'insert.sql'), 'utf8')
9 |
10 | if (fs.existsSync(db)) {
11 | fs.unlinkSync(db)
12 | }
13 |
14 | var connection = new sqlite3.Database(db)
15 |
16 | connection.serialize(() => {
17 | connection.exec(schema)
18 | connection.exec(insert)
19 | })
20 |
21 | connection.close()
22 |
--------------------------------------------------------------------------------
/custom/app4/app.js:
--------------------------------------------------------------------------------
1 |
2 | var express = require('express')
3 | var app = module.exports = express()
4 | var path = require('path')
5 |
6 | app.set('views', path.join(__dirname, 'views'))
7 |
8 | app.get('/view4', (req, res, next) => {
9 |
10 | var relative = path.relative(res.locals._admin.views, app.get('views'))
11 |
12 | res.locals.breadcrumbs = {
13 | links: [
14 | {url: '/', text: res.locals.string.home},
15 | {active: true, text: 'Breadcrumbs'}
16 | ]
17 | }
18 |
19 | res.locals.partials = {
20 | content: path.join(relative, 'view')
21 | }
22 |
23 | next()
24 | })
25 |
--------------------------------------------------------------------------------
/custom/app1/view.html:
--------------------------------------------------------------------------------
1 |
2 | Hello Custom View bootstrap enabled
3 |
4 | This is the simplest custom view that you can get
5 |
6 |
7 | Note that libraries like Bootstrap v3.3.1 , jQuery v1.9.1 , Chosen v1.2.0 and Bootstrap Datepicker are loaded by default.
8 |
9 | Additionally Bootswatch will style your content accordingly. Pick a Theme from the dropdown inside the header.
10 |
11 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "express-admin-examples",
3 | "version": "1.0.0",
4 | "description": "Express Admin Examples",
5 | "private": true,
6 | "keywords": [],
7 | "license": "MIT",
8 | "homepage": "https://github.com/simov/express-admin-examples",
9 | "author": "Simeon Velichkov (https://simov.github.io)",
10 | "repository": {
11 | "type": "git",
12 | "url": "https://github.com/simov/express-admin-examples.git"
13 | },
14 | "dependencies": {
15 | "cloudinary": "^1.33.0",
16 | "express": "^4.18.2",
17 | "express-admin": "^2.0.0",
18 | "moment": "^2.29.4",
19 | "mysql": "^2.18.1",
20 | "pg": "^8.9.0",
21 | "sqlite3": "^5.1.4"
22 | },
23 | "devDependencies": {},
24 | "engines": {
25 | "node": ">=18.0.0"
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/custom/app3/views/view.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Local Static Files
6 |
7 | Static files referenced inside the view template
8 |
9 |
10 | Static css and js can be added to the template itself, that way they will be loaded only for this view.
11 |
12 | Remember that you still have to specify the absolute path to your public directory inside the custom configuration.
13 |
14 |
15 |
16 |
I'm styled through custom global css file.
17 |
18 |
19 |
20 |
I'm styled through custom local css file.
21 |
22 |
--------------------------------------------------------------------------------
/custom/editors/upload.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
12 |
18 |
19 |
20 | {{path}}
21 |
22 | {{#error}}
23 |
24 | {{error}}
25 |
26 | {{/error}}
27 |
28 |
29 |
--------------------------------------------------------------------------------
/custom/static/images.js:
--------------------------------------------------------------------------------
1 |
2 | $(function () {
3 | // show all images inside the ListView
4 | $('.x-table tbody tr').each(function (index) {
5 | // the image column is second
6 | var td = $('td:eq(1)', this)
7 | // get the image url
8 | var url = td.text().trim()
9 |
10 | // skip on missing url
11 | if (!url) return
12 | // by default all uploads go to express-admin/public/upload
13 | if (!url.match(/^http/)) url = '/upload/' + url
14 |
15 | // add image to this table cell
16 | td.html(' ')
17 | })
18 |
19 | // show all images inside the EditView
20 | $('.x-table [type=file]').each(function (index) {
21 | var holder = $(this).parent().prev()
22 | // get the image url
23 | var url = holder.find('[type=text]').val()
24 |
25 | // skip on missing url
26 | if (!url) return
27 | // by default all uploads go to express-admin/public/upload
28 | if (!url.match(/^http/)) url = '/upload/' + url
29 |
30 | // add image to this table cell
31 | holder.append(' ')
32 | })
33 |
34 | // Hint: you can use any jQuery plugin here
35 | })
36 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2013-present Simeon Velichkov (https://github.com/simov/express-admin)
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.5'
2 | services:
3 | mysql:
4 | image: mysql:8
5 | container_name: x-admin-mysql
6 | volumes:
7 | - ./fixtures:/fixtures:ro
8 | command: --default-authentication-plugin=mysql_native_password
9 | ports:
10 | - 8123:3306
11 | environment:
12 | MYSQL_ROOT_PASSWORD: x-admin
13 | mysql5:
14 | image: mysql:5
15 | container_name: x-admin-mysql-5
16 | volumes:
17 | - ./fixtures:/fixtures:ro
18 | command: --default-authentication-plugin=mysql_native_password
19 | ports:
20 | - 8123:3306
21 | environment:
22 | MYSQL_ROOT_PASSWORD: x-admin
23 | mariadb:
24 | image: mariadb:10.10
25 | container_name: x-admin-mariadb
26 | volumes:
27 | - ./fixtures:/fixtures:ro
28 | ports:
29 | - 8123:3306
30 | environment:
31 | MARIADB_ROOT_PASSWORD: x-admin
32 | pg:
33 | image: postgres:15
34 | container_name: x-admin-pg
35 | volumes:
36 | - ./fixtures:/fixtures:ro
37 | ports:
38 | - 8234:5432
39 | environment:
40 | POSTGRES_PASSWORD: x-admin
41 | pg9:
42 | image: postgres:9.3
43 | container_name: x-admin-pg-9
44 | volumes:
45 | - ./fixtures:/fixtures:ro
46 | ports:
47 | - 8234:5432
48 | environment:
49 | POSTGRES_PASSWORD: x-admin
50 |
--------------------------------------------------------------------------------
/custom/highcharts/pie.js:
--------------------------------------------------------------------------------
1 |
2 | // generate the pie chart's data
3 | function pieData (rows, total) {
4 | var ratio = parseFloat(total) / 100 // total / 100%
5 | var data = []
6 |
7 | for (var i=0; i < rows.length; i++) {
8 | var percentage = parseFloat(rows[i].total) / ratio
9 | data.push({
10 | name: rows[i].name,
11 | y: parseFloat(percentage.toFixed(2)),
12 | total: parseInt(rows[i].total) // custom data
13 | })
14 | }
15 | return data
16 | }
17 |
18 | exports.chart = (month, rows, total) => ({
19 | chart: {
20 | renderTo: 'chart-pie',
21 | plotBackgroundColor: null,
22 | plotBorderWidth: null,
23 | plotShadow: false
24 | },
25 | title: {
26 | text: '$'+total+' spend for goods in '+month
27 | },
28 | tooltip: {
29 | pointFormat: '{series.name}: {point.percentage}% ',
30 | percentageDecimals: 1,
31 | formatter: 'all callback functions are defined in the browser!'
32 | },
33 | plotOptions: {
34 | pie: {
35 | allowPointSelect: true,
36 | cursor: 'pointer',
37 | dataLabels: {
38 | enabled: true,
39 | color: '#000000',
40 | connectorColor: '#000000',
41 | formatter: 'all callback functions are defined in the browser!'
42 | }
43 | }
44 | },
45 | series: [{
46 | type: 'pie',
47 | name: 'Spend',
48 | data: pieData(rows, total)
49 | }]
50 | })
51 |
--------------------------------------------------------------------------------
/custom/editors/app.js:
--------------------------------------------------------------------------------
1 |
2 | var express = require('express')
3 | var app = module.exports = express()
4 | var fs = require('fs')
5 | var path = require('path')
6 |
7 | // set your custom views path
8 | app.set('views', path.join(__dirname, 'views'))
9 |
10 | app.post(/^\/upload.*$/i, (req, res, next) => {
11 | var file = req.files.upload
12 | // file.name // file-name.jpg
13 | // file.path // /tmp/9c9b10b72fe71be752bd3895f1185bc8
14 | // file.size // 27124
15 | // file.type // image/jpeg
16 |
17 | var source = file.path
18 | var target = path.join(path.resolve(__dirname, 'uploads'), file.name)
19 |
20 | fs.readFile(source, (err, data) => {
21 | if (err) return next(err)
22 | getname(target, (target, fname) => {
23 | fs.writeFile(target, data, (err) => {
24 | if (err) return next(err)
25 | // render custom page inside the editor's popup frame
26 | res.locals.path = '/uploads/'+fname
27 | var template = path.resolve(__dirname, 'upload.html')
28 | res.render(template)
29 | })
30 | })
31 | })
32 | })
33 |
34 | // prevent overriding existing files
35 | function getname (target, done) {
36 | var ext = path.extname(target)
37 | var fname = path.basename(target, ext)
38 | var dpath = path.dirname(target)
39 | fs.exists(target, (exists) => {
40 | return exists ? loop(1) : done(target, fname+ext)
41 | })
42 | function loop (i) {
43 | var name = fname+'-'+i
44 | var fpath = path.join(dpath, name+ext)
45 | fs.exists(fpath, (exists) => {
46 | return exists ? loop(++i) : done(fpath, name+ext)
47 | })
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | # Express Admin Examples
3 |
4 | > _Examples for [Express Admin]_
5 |
6 | ## Environment
7 |
8 | - node >= 14
9 | - npm
10 | - docker
11 | - docker-compose
12 |
13 | ## MySQL
14 |
15 | ```bash
16 | # start MySQL database server (pick one)
17 | docker-compose up mysql
18 | docker-compose up mysql5
19 | docker-compose up mariadb
20 | # login to the running container (pick one)
21 | docker exec -it x-admin-mysql bash
22 | docker exec -it x-admin-mysql-5 bash
23 | docker exec -it x-admin-mariadb bash
24 | # login to mysql
25 | mysql -u root -p
26 | ```
27 | ```sql
28 | -- create database
29 | create schema `x-admin-examples` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ;
30 | ```
31 | ```bash
32 | # import schema
33 | mysql -p --user=root 'x-admin-examples' < fixtures/mysql/schema.sql
34 | mysql -p --user=root 'x-admin-examples' < fixtures/mysql/insert.sql
35 | ```
36 |
37 | ## PostgreSQL
38 |
39 | ```bash
40 | # start PostgreSQL database server (pick one)
41 | docker-compose up pg
42 | docker-compose up pg9
43 | # login to the running container (pick one)
44 | docker exec -it x-admin-pg bash
45 | docker exec -it x-admin-pg-9 bash
46 | # login to psql
47 | psql -U postgres
48 | ```
49 | ```sql
50 | # create database
51 | create database "x-admin-examples";
52 | ```
53 | ```bash
54 | # import schema
55 | psql -U postgres 'x-admin-examples' < fixtures/pg/schema.sql
56 | psql -U postgres 'x-admin-examples' < fixtures/pg/insert.sql
57 | ```
58 |
59 | ## SQLite
60 |
61 | ```bash
62 | # create database and import schema
63 | node fixtures/sqlite-import.js
64 | ```
65 |
66 | ## Examples
67 |
68 | ```bash
69 | # install test dependencies
70 | npm install
71 | # update absolute paths set inside the config folder
72 | node path.js
73 | # start the admin
74 | node start.js mysql # or pg, sqlite
75 | ```
76 |
77 | Navigate to http://localhost:3000 user `admin` pass `1234abCD`
78 |
79 | ## Diagrams
80 |
81 | [MySQL Workbench] can be used to preview the [database diagrams].
82 |
83 |
84 | [Express Admin]: https://github.com/simov/express-admin
85 | [MySQL Workbench]: https://www.mysql.com/products/workbench/
86 | [database diagrams]: https://github.com/simov/express-admin-examples/blob/master/fixtures/x-admin-examples.mwb
87 |
--------------------------------------------------------------------------------
/custom/highcharts/views/form.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
14 |
15 |
16 | Highcharts
17 |
18 |
34 |
35 |
60 |
61 |
62 | {{>readme}}
63 |
--------------------------------------------------------------------------------
/config/custom.json:
--------------------------------------------------------------------------------
1 | {
2 | "Custom View - Basics": {
3 | "app": {
4 | "path": "/home/s/git/express-admin-examples/custom/app1/app.js",
5 | "slug": "view1",
6 | "verbose": "Hello Custom View",
7 | "mainview": {
8 | "show": true
9 | }
10 | }
11 | },
12 | "Custom View - Global Static Files": {
13 | "app": {
14 | "path" : "/home/s/git/express-admin-examples/custom/app2/app.js",
15 | "slug": "view2",
16 | "verbose": "Custom Global Static Files",
17 | "mainview": {
18 | "show": true
19 | }
20 | },
21 | "public": {
22 | "local": {
23 | "path": "/home/s/git/express-admin-examples/custom/app2/public",
24 | "css": [
25 | "/css/global.css"
26 | ],
27 | "js": [
28 | "/js/global.js"
29 | ]
30 | }
31 | }
32 | },
33 | "Custom View - Local Static Files": {
34 | "app": {
35 | "path" : "/home/s/git/express-admin-examples/custom/app3/app.js",
36 | "slug": "view3",
37 | "verbose": "Custom Local Static Files",
38 | "mainview": {
39 | "show": true
40 | }
41 | },
42 | "public": {
43 | "local": {
44 | "path": "/home/s/git/express-admin-examples/custom/app3/public"
45 | }
46 | }
47 | },
48 | "Custom View - Breadcrumbs": {
49 | "app": {
50 | "path" : "/home/s/git/express-admin-examples/custom/app4/app.js",
51 | "slug": "view4",
52 | "verbose": "Breadcrumbs",
53 | "mainview": {
54 | "show": true
55 | }
56 | }
57 | },
58 | "Custom View - Highcharts": {
59 | "app": {
60 | "path" : "/home/s/git/express-admin-examples/custom/highcharts/app.js",
61 | "slug": "stats",
62 | "verbose": "Highcharts",
63 | "mainview": {
64 | "show": true
65 | }
66 | }
67 | },
68 | "Custom Component - Text Editors + Backend": {
69 | "app": {
70 | "path": "/home/s/git/express-admin-examples/custom/editors/app.js",
71 | "slug": "upload"
72 | },
73 | "public": {
74 | "external": {
75 | "js": [
76 | "https://cdn.ckeditor.com/4.4.2/standard/ckeditor.js",
77 | "https://cdn.tiny.cloud/1/no-api-key/tinymce/6/tinymce.min.js"
78 | ]
79 | },
80 | "local": {
81 | "path": "/home/s/git/express-admin-examples/custom/editors",
82 | "js": [
83 | "/editors.js"
84 | ]
85 | }
86 | }
87 | },
88 | "Custom Static Files": {
89 | "public": {
90 | "local": {
91 | "path": "/home/s/git/express-admin-examples/custom/static",
92 | "js": [
93 | "/mtm-tags.js",
94 | "/theme.js",
95 | "/images.js",
96 | "/binary.js"
97 | ]
98 | }
99 | }
100 | },
101 | "Event Hooks": {
102 | "events": "/home/s/git/express-admin-examples/custom/events/events.js"
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/custom/editors/editors.js:
--------------------------------------------------------------------------------
1 |
2 | $(function () {
3 |
4 | if (typeof CKEDITOR !== 'undefined') {
5 |
6 | CKEDITOR.replaceAll(function (textarea, config) {
7 | // exclude textareas that are inside hidden inline rows
8 | if ($(textarea).parents('tr').hasClass('blank')) return false
9 | // textareas with this class name will get the default configuration
10 | if (textarea.className.includes('ck-full')) return true
11 | // textareas with this class name will have custom configuration
12 | if (textarea.className.includes('ck-compact'))
13 | return setCustomConfig(config)
14 | // all other textareas won't be initialized as ckeditors
15 | return false
16 | })
17 |
18 | // upload image dialog
19 | CKEDITOR.on('dialogDefinition', function (e) {
20 | // Take the dialog name and its definition from the event data.
21 | var dialogDefinition = e.data.definition,
22 | uploadTab = dialogDefinition.getContents('Upload')
23 |
24 | if (uploadTab) {
25 | // add the _csrf token to the request
26 | uploadTab.elements[0].action
27 | += '&_csrf='+ encodeURIComponent($('[name=_csrf]').val())
28 | }
29 | })
30 | }
31 |
32 | if (typeof tinymce !== 'undefined') {
33 | // it's important to initialize only the visible textareas
34 | tinymce.init({
35 | selector: 'tr:not(.blank) .tinymce',
36 | })
37 | }
38 | })
39 |
40 | // ckeditor only
41 | function onUpload (src) {
42 | $('.cke_dialog_contents label.cke_required:contains("URL") + div div input').val(src)
43 | $('.cke_dialog_ui_button_ok')[0].click()
44 | }
45 |
46 | // ckeditor only
47 | function setCustomConfig (config) {
48 | config = config || {}
49 | // upload images
50 | CKEDITOR.config.filebrowserUploadUrl = '/upload'
51 | // toolbar
52 | config.toolbarGroups = [
53 | { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
54 | { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align' ] },
55 | '/',
56 | { name: 'styles' },
57 | { name: 'colors' },
58 | { name: 'insert' }
59 | ]
60 | config.removeButtons = 'Smiley,SpecialChar,PageBreak,Iframe,CreateDiv,Table,Flash,HorizontalRule'
61 |
62 | return config
63 | }
64 |
65 | // executed each time an inline is added
66 | function onAddInline (rows) {
67 | if (typeof CKEDITOR !== 'undefined') {
68 | // for each of the new rows containing textareas
69 | $('textarea', rows).each(function (index) {
70 | // get the DOM instance
71 | var textarea = $(this)[0]
72 |
73 | // textareas with this class name will get the default configuration
74 | if (textarea.className.includes('ck-full')) return CKEDITOR.replace(textarea)
75 | // textareas with this class name will have custom configuration
76 | if (textarea.className.includes('ck-compact'))
77 | return CKEDITOR.replace(textarea, setCustomConfig())
78 | // all other textareas won't be initialized as ckeditors
79 | return false
80 | })
81 | }
82 |
83 | if (typeof tinymce !== 'undefined') {
84 | // init tinymce editors
85 | tinymce.init({
86 | selector: 'tr:not(.blank) .tinymce',
87 | })
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/custom/highcharts/app.js:
--------------------------------------------------------------------------------
1 |
2 | var express = require('express')
3 | var app = module.exports = express()
4 | var path = require('path')
5 |
6 | var moment = require('moment')
7 | // pie chart settings
8 | var pie = require('./pie')
9 |
10 | app.set('views', path.join(__dirname, 'views'))
11 |
12 |
13 | app.get(/\/stats(?:\/(\w+))?/, (req, res, next) => {
14 | // reuse the admin's database connection
15 | var db = res.locals._admin.db
16 |
17 | // get the month from the url
18 | var month = req.params[0] || 'january'
19 |
20 | queryDatabase(db, month, (err, rows, total) => {
21 | if (err) return next(err)
22 |
23 | // pie chart's settings
24 | res.locals.chart = JSON.stringify(pie.chart(month, rows, total))
25 | // month's select control data
26 | res.locals.months = getMonths(month)
27 |
28 | next()
29 | })
30 | })
31 |
32 | app.post(/\/stats(?:\/(\w+))?/, (req, res, next) => {
33 | // reuse the admin's database connection
34 | var db = res.locals._admin.db
35 |
36 | // get the month from the POST params
37 | var month = req.body.month
38 |
39 | queryDatabase(db, month, (err, rows, total) => {
40 | if (err) return next(err)
41 |
42 | // pie chart's settings
43 | res.locals.chart = JSON.stringify(pie.chart(month, rows, total))
44 | // month's select control data
45 | res.locals.months = getMonths(month)
46 |
47 | next()
48 | })
49 | })
50 |
51 | // common data for each request to this view
52 | app.all(/\/stats(?:\/(\w+))?/, (req, res, next) => {
53 | var relative = path.relative(res.locals._admin.views, app.get('views'))
54 |
55 | res.locals.breadcrumbs = req.params[0] ? {
56 | links: [
57 | {url: '/', text: res.locals.string.home},
58 | {url: '/stats', text: 'Stats'},
59 | {active: true, text: req.params[0]}
60 | ]
61 | } : {
62 | links: [
63 | {url: '/', text: res.locals.string.home},
64 | {active: true, text: 'Stats'}
65 | ]
66 | }
67 |
68 | res.locals.partials = {
69 | content: path.join(relative, 'form'),
70 | readme: path.join(relative, 'readme')
71 | }
72 |
73 | next()
74 | })
75 |
76 | function getMonths (month) {
77 | var months = [
78 | {value: 'january', text: 'January'},
79 | {value: 'february', text: 'February'},
80 | {value: 'mart', text: 'Mart'},
81 | {value: 'april', text: 'April'},
82 | {value: 'may', text: 'May'},
83 | {value: 'june', text: 'June'}
84 | ]
85 | // set the selected month
86 | for (var i=0; i < months.length; i++) {
87 | if (months[i].value === month) {
88 | months[i].selected = true
89 | break
90 | }
91 | }
92 | return months
93 | }
94 |
95 | function queryDatabase (db, month, done) {
96 | // find the first and last date of the selected month (all test dates are in 2012)
97 | var date = moment('2012-'+month, 'YYYY-MMMM')
98 | var first = date.startOf('month').format('YYYY-MM-DD')
99 | var last = date.endOf('month').format('YYYY-MM-DD')
100 |
101 | // group by item and sum its cache for the selected month
102 | var sql = "select `name`, SUM(`cache`) as 'total'\
103 | from `purchase` join `item`\
104 | on `purchase`.`item_id` = `item`.`id`\
105 | where DATE(`date`) between '"+first+"' and '"+last+"'\
106 | group by `item_id`;"
107 |
108 | db.client.query(sql, (err, items) => {
109 | if (err) return done(err)
110 |
111 | // total spend cache for this month
112 | var sql = "select SUM(`cache`) as 'total'\
113 | from `purchase`\
114 | where DATE(`date`) between '"+first+"' and '"+last+"';"
115 |
116 | db.client.query(sql, (err, sum) => {
117 | if (err) return done(err)
118 |
119 | // queries results
120 | var rows = items
121 | var total = sum[0].total
122 |
123 | done(null, rows, total)
124 | })
125 | })
126 | }
127 |
--------------------------------------------------------------------------------
/custom/events/events.js:
--------------------------------------------------------------------------------
1 |
2 | var moment = require('moment')
3 |
4 | function quotes (args, result) {
5 | return args.db.client.pg ? result.replace(/`/g,'"') : result
6 | }
7 |
8 |
9 | exports.preSave = (req, res, args, next) => {
10 | if (args.debug) console.log('preSave')
11 | debugger
12 |
13 | // created_at, updated_at
14 | if (args.name == 'user') {
15 | var now = moment(new Date()).format('YYYY-MM-DD hh:mm:ss')
16 | var record = args.data.view.user.records[0].columns
17 | if (args.action == 'insert') {
18 | record.created_at = now
19 | record.updated_at = now
20 | }
21 | else if (args.action == 'update') {
22 | record.updated_at = now
23 | }
24 | }
25 |
26 | // soft delete
27 | if (args.name == 'purchase') {
28 | var now = moment(new Date()).format('YYYY-MM-DD hh:mm:ss')
29 | // all inline oneToOne and manyToOne records should be marked as deleted
30 | for (var table in args.data.manyToOne) {
31 | var inline = args.data.manyToOne[table]
32 | if (!inline.records) continue
33 | for (var i=0; i < inline.records.length; i++) {
34 | if (args.action != 'remove' && !inline.records[i].remove) continue
35 | // instead of deleting the record
36 | delete inline.records[i].remove
37 | // update it
38 | inline.records[i].columns.deleted = (args.db.client.sqlite ? 1 : true)
39 | inline.records[i].columns.deleted_at = now
40 | }
41 | }
42 | // parent record
43 | if (args.action == 'remove') {
44 | // instead of deleting the record
45 | args.action = 'update'
46 | // update it
47 | var record = args.data.view.purchase.records[0].columns
48 | record.deleted = (args.db.client.sqlite ? 1 : true)
49 | record.deleted_at = now
50 | }
51 | }
52 |
53 | next()
54 | }
55 |
56 |
57 | // upload image to cloudinary.com
58 | var config = {
59 | cloud_name: '',
60 | api_key: '',
61 | api_secret: ''
62 | }
63 | if (config.api_secret) {
64 | var cloudinary = require('cloudinary')
65 | var fs = require('fs')
66 | var path = require('path')
67 | cloudinary.config(config)
68 | }
69 |
70 | exports.postSave = (req, res, args, next) => {
71 | if (args.debug) console.log('postSave')
72 | debugger
73 |
74 | // upload image to a third party server
75 | if (args.name == 'item') {
76 | // provide your credentials to cloudinary.com
77 | if (!config.api_secret) return next()
78 | // file upload control data
79 | var image = args.upload.view.item.records[0].columns.image
80 | // in case file is chosen through the file input control
81 | if (image.name) {
82 | // file name of the image already uploaded to the upload folder
83 | var fname = args.data.view.item.records[0].columns.image
84 | // upload
85 | var fpath = path.join(args.upath, fname)
86 | cloudinary.uploader.upload(fpath, (result) => {
87 | console.log(result)
88 | next()
89 | })
90 | }
91 | else next()
92 | }
93 | else next()
94 | }
95 |
96 |
97 | exports.preList = (req, res, args, next) => {
98 | if (args.debug) console.log('preList')
99 | debugger
100 |
101 | if (args.name == 'purchase') {
102 | // check if we're using listview's filter
103 | // and actually want to see soft deleted records
104 | var filter = args.filter.columns
105 | if (filter && (filter.deleted=='1' || filter.deleted_at && filter.deleted_at[0])) {
106 | return next()
107 | }
108 | // otherwise hide the soft deleted records by default
109 | var filter = quotes(args,
110 | ' `purchase`.`deleted` IS NULL OR `purchase`.`deleted` = ' +
111 | (args.db.client.pg ? 'false' : 0) +
112 | ' OR `purchase`.`deleted_at` IS NULL ')
113 | args.statements.where
114 | ? args.statements.where += ' AND ' + filter
115 | : args.statements.where = ' WHERE ' + filter
116 | }
117 |
118 | next()
119 | }
120 |
--------------------------------------------------------------------------------
/fixtures/sqlite/schema.sql:
--------------------------------------------------------------------------------
1 |
2 | -- -----------------------------------------------------
3 | -- Table `notes`
4 | -- -----------------------------------------------------
5 | CREATE TABLE `notes` (
6 | `notes1` TEXT NULL,
7 | `notes2` TEXT NOT NULL,
8 | `notes3` TEXT NULL,
9 | `notes4` TEXT NOT NULL);
10 |
11 |
12 | -- -----------------------------------------------------
13 | -- Table `item`
14 | -- -----------------------------------------------------
15 | CREATE TABLE `item` (
16 | `name` VARCHAR(45) NOT NULL,
17 | `description` TEXT NULL,
18 | `image` VARCHAR(255) NULL);
19 |
20 |
21 | -- -----------------------------------------------------
22 | -- Table `user`
23 | -- -----------------------------------------------------
24 | CREATE TABLE `user` (
25 | `firstname` VARCHAR(45) NOT NULL,
26 | `lastname` VARCHAR(45) NULL,
27 | `created_at` DATETIME NOT NULL,
28 | `updated_at` DATETIME NOT NULL);
29 |
30 |
31 | -- -----------------------------------------------------
32 | -- Table `purchase`
33 | -- -----------------------------------------------------
34 | CREATE TABLE `purchase` (
35 | `item_id` INT NOT NULL,
36 | `user_id` INT NULL,
37 | `cache` DECIMAL(6,2) NOT NULL,
38 | `date` DATE NULL,
39 | `deleted` TINYINT(1) NULL,
40 | `deleted_at` DATETIME NULL,
41 | CONSTRAINT `fk_purchase_item`
42 | FOREIGN KEY (`item_id`)
43 | REFERENCES `item` (`rowid`)
44 | ON DELETE NO ACTION
45 | ON UPDATE NO ACTION,
46 | CONSTRAINT `fk_purchase_user1`
47 | FOREIGN KEY (`user_id`)
48 | REFERENCES `user` (`rowid`)
49 | ON DELETE NO ACTION
50 | ON UPDATE NO ACTION);
51 |
52 |
53 | -- -----------------------------------------------------
54 | -- Table `recipe`
55 | -- -----------------------------------------------------
56 | CREATE TABLE `recipe` (
57 | `name` VARCHAR(45) NOT NULL);
58 |
59 |
60 | -- -----------------------------------------------------
61 | -- Table `recipe_type`
62 | -- -----------------------------------------------------
63 | CREATE TABLE `recipe_type` (
64 | `title` VARCHAR(45) NOT NULL);
65 |
66 |
67 | -- -----------------------------------------------------
68 | -- Table `recipe_method`
69 | -- -----------------------------------------------------
70 | CREATE TABLE `recipe_method` (
71 | `title` VARCHAR(45) NOT NULL);
72 |
73 |
74 | -- -----------------------------------------------------
75 | -- Table `recipe_has_recipe_types`
76 | -- -----------------------------------------------------
77 | CREATE TABLE `recipe_has_recipe_types` (
78 | `recipe_id` INT NOT NULL,
79 | `recipe_type_id` INT NOT NULL,
80 | CONSTRAINT `fk_recipe_has_recipe_type_recipe1`
81 | FOREIGN KEY (`recipe_id`)
82 | REFERENCES `recipe` (`id`)
83 | ON DELETE NO ACTION
84 | ON UPDATE NO ACTION,
85 | CONSTRAINT `fk_recipe_has_recipe_type_recipe_type1`
86 | FOREIGN KEY (`recipe_type_id`)
87 | REFERENCES `recipe_type` (`id`)
88 | ON DELETE NO ACTION
89 | ON UPDATE NO ACTION);
90 |
91 |
92 | -- -----------------------------------------------------
93 | -- Table `recipe_has_recipe_methods`
94 | -- -----------------------------------------------------
95 | CREATE TABLE `recipe_has_recipe_methods` (
96 | `recipe_id` INT NOT NULL,
97 | `recipe_method_id` INT NOT NULL,
98 | CONSTRAINT `fk_recipe_has_recipe_methods_recipe1`
99 | FOREIGN KEY (`recipe_id`)
100 | REFERENCES `recipe` (`id`)
101 | ON DELETE NO ACTION
102 | ON UPDATE NO ACTION,
103 | CONSTRAINT `fk_recipe_has_recipe_methods_recipe_method1`
104 | FOREIGN KEY (`recipe_method_id`)
105 | REFERENCES `recipe_method` (`id`)
106 | ON DELETE NO ACTION
107 | ON UPDATE NO ACTION);
108 |
109 |
110 | -- -----------------------------------------------------
111 | -- Table `address`
112 | -- -----------------------------------------------------
113 | CREATE TABLE `address` (
114 | `user_id` INT NOT NULL,
115 | `street` VARCHAR(45) NOT NULL,
116 | CONSTRAINT `fk_address_user1`
117 | FOREIGN KEY (`user_id`)
118 | REFERENCES `user` (`id`)
119 | ON DELETE NO ACTION
120 | ON UPDATE NO ACTION);
121 |
122 |
123 | -- -----------------------------------------------------
124 | -- Table `phone`
125 | -- -----------------------------------------------------
126 | CREATE TABLE `phone` (
127 | `user_id` INT NOT NULL,
128 | `mobile` VARCHAR(45) NOT NULL,
129 | CONSTRAINT `fk_phone_user1`
130 | FOREIGN KEY (`user_id`)
131 | REFERENCES `user` (`id`)
132 | ON DELETE NO ACTION
133 | ON UPDATE NO ACTION);
134 |
135 |
136 | -- -----------------------------------------------------
137 | -- Table `car`
138 | -- -----------------------------------------------------
139 | CREATE TABLE `car` (
140 | `model` VARCHAR(45) NOT NULL);
141 |
142 |
143 | -- -----------------------------------------------------
144 | -- Table `repair`
145 | -- -----------------------------------------------------
146 | CREATE TABLE `repair` (
147 | `car_id` INT NOT NULL,
148 | `date` DATE NOT NULL,
149 | CONSTRAINT `fk_repair_car1`
150 | FOREIGN KEY (`car_id`)
151 | REFERENCES `car` (`id`)
152 | ON DELETE NO ACTION
153 | ON UPDATE NO ACTION);
154 |
155 |
156 | -- -----------------------------------------------------
157 | -- Table `driver`
158 | -- -----------------------------------------------------
159 | CREATE TABLE `driver` (
160 | `car_id` INT NOT NULL,
161 | `name` VARCHAR(45) NOT NULL,
162 | CONSTRAINT `fk_driver_car1`
163 | FOREIGN KEY (`car_id`)
164 | REFERENCES `car` (`id`)
165 | ON DELETE NO ACTION
166 | ON UPDATE NO ACTION);
167 |
168 |
169 | -- -----------------------------------------------------
170 | -- Table `controls_otm_single`
171 | -- -----------------------------------------------------
172 | CREATE TABLE `controls_otm_single` (
173 | `name` VARCHAR(45) NOT NULL);
174 |
175 |
176 | -- -----------------------------------------------------
177 | -- Table `controls_otm_multiple`
178 | -- -----------------------------------------------------
179 | CREATE TABLE `controls_otm_multiple` (
180 | `first` VARCHAR(45) NOT NULL,
181 | `last` VARCHAR(45) NULL);
182 |
183 |
184 | -- -----------------------------------------------------
185 | -- Table `controls`
186 | -- -----------------------------------------------------
187 | CREATE TABLE `controls` (
188 | `controls_otm_single_id` INT NULL,
189 | `controls_otm_multiple_id` INT NULL,
190 | `static` VARCHAR(45) NULL,
191 | `text` VARCHAR(45) NULL,
192 | `boolean` TINYINT(1) NULL,
193 | `bigint` BIGINT NULL,
194 | `double` DOUBLE NULL,
195 | `upload` VARCHAR(45) NULL,
196 | `binary` BLOB NULL,
197 | `date` DATE NULL,
198 | `time` TIME NULL,
199 | `datetime` DATETIME NULL,
200 | `year` YEAR NULL,
201 | `textarea` TEXT NULL,
202 | CONSTRAINT `fk_controls_controls_otm_single1`
203 | FOREIGN KEY (`controls_otm_single_id`)
204 | REFERENCES `controls_otm_single` (`id`)
205 | ON DELETE NO ACTION
206 | ON UPDATE NO ACTION,
207 | CONSTRAINT `fk_controls_controls_otm_multiple1`
208 | FOREIGN KEY (`controls_otm_multiple_id`)
209 | REFERENCES `controls_otm_multiple` (`id`)
210 | ON DELETE NO ACTION
211 | ON UPDATE NO ACTION);
212 |
213 |
214 | -- -----------------------------------------------------
215 | -- Table `controls_mtm_single`
216 | -- -----------------------------------------------------
217 | CREATE TABLE `controls_mtm_single` (
218 | `name` VARCHAR(45) NOT NULL);
219 |
220 |
221 | -- -----------------------------------------------------
222 | -- Table `controls_mtm_multiple`
223 | -- -----------------------------------------------------
224 | CREATE TABLE `controls_mtm_multiple` (
225 | `first` VARCHAR(45) NOT NULL,
226 | `last` VARCHAR(45) NULL);
227 |
228 |
229 | -- -----------------------------------------------------
230 | -- Table `controls_has_controls_mtm_single`
231 | -- -----------------------------------------------------
232 | CREATE TABLE `controls_has_controls_mtm_single` (
233 | `controls_id` INT NOT NULL,
234 | `controls_mtm_single_id` INT NOT NULL,
235 | CONSTRAINT `fk_controls_has_controls_mtm_single_controls1`
236 | FOREIGN KEY (`controls_id`)
237 | REFERENCES `controls` (`id`)
238 | ON DELETE NO ACTION
239 | ON UPDATE NO ACTION,
240 | CONSTRAINT `fk_controls_has_controls_mtm_single_controls_mtm_single1`
241 | FOREIGN KEY (`controls_mtm_single_id`)
242 | REFERENCES `controls_mtm_single` (`id`)
243 | ON DELETE NO ACTION
244 | ON UPDATE NO ACTION);
245 |
246 |
247 | -- -----------------------------------------------------
248 | -- Table `controls_has_controls_mtm_multiple`
249 | -- -----------------------------------------------------
250 | CREATE TABLE `controls_has_controls_mtm_multiple` (
251 | `controls_id` INT NOT NULL,
252 | `controls_mtm_multiple_id` INT NOT NULL,
253 | CONSTRAINT `fk_controls_has_controls_mtm_multiple_controls1`
254 | FOREIGN KEY (`controls_id`)
255 | REFERENCES `controls` (`id`)
256 | ON DELETE NO ACTION
257 | ON UPDATE NO ACTION,
258 | CONSTRAINT `fk_controls_has_controls_mtm_multiple_controls_mtm_multiple1`
259 | FOREIGN KEY (`controls_mtm_multiple_id`)
260 | REFERENCES `controls_mtm_multiple` (`id`)
261 | ON DELETE NO ACTION
262 | ON UPDATE NO ACTION);
263 |
264 |
265 | -- -----------------------------------------------------
266 | -- Table `controls_inline_otm_single`
267 | -- -----------------------------------------------------
268 | CREATE TABLE `controls_inline_otm_single` (
269 | `name` VARCHAR(45) NOT NULL);
270 |
271 |
272 | -- -----------------------------------------------------
273 | -- Table `controls_inline_otm_multiple`
274 | -- -----------------------------------------------------
275 | CREATE TABLE `controls_inline_otm_multiple` (
276 | `first` VARCHAR(45) NOT NULL,
277 | `last` VARCHAR(45) NULL);
278 |
279 |
280 | -- -----------------------------------------------------
281 | -- Table `controls_inline`
282 | -- -----------------------------------------------------
283 | CREATE TABLE `controls_inline` (
284 | `controls_id` INT NOT NULL,
285 | `controls_inline_otm_single_id` INT NOT NULL,
286 | `controls_inline_otm_multiple_id` INT NOT NULL,
287 | `static` VARCHAR(45) NOT NULL,
288 | `text` VARCHAR(45) NOT NULL,
289 | `boolean` TINYINT(1) NOT NULL,
290 | `bigint` BIGINT NOT NULL,
291 | `double` DOUBLE NOT NULL,
292 | `upload` VARCHAR(45) NOT NULL,
293 | `binary` BLOB NOT NULL,
294 | `date` DATE NOT NULL,
295 | `time` TIME NOT NULL,
296 | `datetime` DATETIME NOT NULL,
297 | `year` YEAR NOT NULL,
298 | `textarea` TEXT NOT NULL,
299 | CONSTRAINT `fk_controls_inline_controls_inline_otm_single1`
300 | FOREIGN KEY (`controls_inline_otm_single_id`)
301 | REFERENCES `controls_inline_otm_single` (`id`)
302 | ON DELETE NO ACTION
303 | ON UPDATE NO ACTION,
304 | CONSTRAINT `fk_controls_inline_controls_inline_otm_multiple1`
305 | FOREIGN KEY (`controls_inline_otm_multiple_id`)
306 | REFERENCES `controls_inline_otm_multiple` (`id`)
307 | ON DELETE NO ACTION
308 | ON UPDATE NO ACTION,
309 | CONSTRAINT `fk_controls_inline_controls1`
310 | FOREIGN KEY (`controls_id`)
311 | REFERENCES `controls` (`id`)
312 | ON DELETE NO ACTION
313 | ON UPDATE NO ACTION);
314 |
315 |
316 | -- -----------------------------------------------------
317 | -- Table `controls_inline_mtm_single`
318 | -- -----------------------------------------------------
319 | CREATE TABLE `controls_inline_mtm_single` (
320 | `name` VARCHAR(45) NOT NULL);
321 |
322 |
323 | -- -----------------------------------------------------
324 | -- Table `controls_inline_mtm_multiple`
325 | -- -----------------------------------------------------
326 | CREATE TABLE `controls_inline_mtm_multiple` (
327 | `first` VARCHAR(45) NOT NULL,
328 | `last` VARCHAR(45) NULL);
329 |
330 |
331 | -- -----------------------------------------------------
332 | -- Table `controls_inline_has_controls_inline_mtm_single`
333 | -- -----------------------------------------------------
334 | CREATE TABLE `controls_inline_has_controls_inline_mtm_single` (
335 | `controls_inline_id` INT NOT NULL,
336 | `controls_inline_mtm_single_id` INT NOT NULL,
337 | CONSTRAINT `fk_controls_inline_has_controls_inline_mtm_single_controls_in1`
338 | FOREIGN KEY (`controls_inline_id`)
339 | REFERENCES `controls_inline` (`id`)
340 | ON DELETE NO ACTION
341 | ON UPDATE NO ACTION,
342 | CONSTRAINT `fk_controls_inline_has_controls_inline_mtm_single_controls_in2`
343 | FOREIGN KEY (`controls_inline_mtm_single_id`)
344 | REFERENCES `controls_inline_mtm_single` (`id`)
345 | ON DELETE NO ACTION
346 | ON UPDATE NO ACTION);
347 |
348 |
349 | -- -----------------------------------------------------
350 | -- Table `controls_inline_has_controls_inline_mtm_multiple`
351 | -- -----------------------------------------------------
352 | CREATE TABLE `controls_inline_has_controls_inline_mtm_multiple` (
353 | `controls_inline_id` INT NOT NULL,
354 | `controls_inline_mtm_multiple_id` INT NOT NULL,
355 | CONSTRAINT `fk_controls_inline_has_controls_inline_mtm_multiple_controls_1`
356 | FOREIGN KEY (`controls_inline_id`)
357 | REFERENCES `controls_inline` (`id`)
358 | ON DELETE NO ACTION
359 | ON UPDATE NO ACTION,
360 | CONSTRAINT `fk_controls_inline_has_controls_inline_mtm_multiple_controls_2`
361 | FOREIGN KEY (`controls_inline_mtm_multiple_id`)
362 | REFERENCES `controls_inline_mtm_multiple` (`id`)
363 | ON DELETE NO ACTION
364 | ON UPDATE NO ACTION);
365 |
--------------------------------------------------------------------------------
/fixtures/sqlite/insert.sql:
--------------------------------------------------------------------------------
1 |
2 | -- One to Many
3 |
4 | insert into `user` (`firstname`,`lastname`,`created_at`,`updated_at`) VALUES ('Jeff','Cox','2014-01-10 22:17:13','2014-01-10 22:17:13');
5 | insert into `user` (`firstname`,`lastname`,`created_at`,`updated_at`) VALUES ('Ann','Hart','2014-01-15 14:57:00','2014-01-15 14:57:00');
6 | insert into `user` (`firstname`,`lastname`,`created_at`,`updated_at`) VALUES ('Jack','Dean','2014-01-20 01:12:33','2014-01-20 01:12:33');
7 |
8 | insert into `item` (`name`,`image`) VALUES ('coffee','http://i.imgur.com/aRGnsmZ.jpg');
9 | insert into `item` (`name`,`image`) VALUES ('tea','http://i.imgur.com/Q4ifnMA.jpg');
10 | insert into `item` (`name`,`image`) VALUES ('energy','http://i.imgur.com/MmWBoOR.jpg');
11 | insert into `item` (`name`,`image`) VALUES ('cherries','');
12 | insert into `item` (`name`,`image`) VALUES ('chocolate','');
13 |
14 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (1,3,17.5,'2012-01-01');
15 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (2,1,37.5,'2012-01-12');
16 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (1,2,66.0,'2012-01-15');
17 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`,`deleted`,`deleted_at`) VALUES (4,3,15.0,'2012-01-27',1,'2012-03-01 1:15');
18 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (1,2,18.9,'2012-02-07');
19 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (2,1,100,'2012-02-19');
20 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (4,3,20.0,'2012-02-20');
21 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (2,3,50.0,'2012-03-08');
22 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (3,1,18.0,'2012-03-16');
23 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (5,2,9.00,'2012-03-18');
24 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (2,3,3.50,'2012-03-29');
25 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (5,1,19.0,'2012-04-09');
26 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (4,2,22.7,'2012-04-13');
27 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (3,3,44.5,'2012-04-21');
28 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`,`deleted`,`deleted_at`) VALUES (1,2,12.6,'2012-04-26',1,'2012-04-28 14:57');
29 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (2,2,16.0,'2012-04-26');
30 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (2,1,40.0,'2012-05-06');
31 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (3,2,16.8,'2012-05-15');
32 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (4,3,9.0,'2012-05-22');
33 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (2,1,40.0,'2012-06-06');
34 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (3,2,16.0,'2012-06-15');
35 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (5,3,19.0,'2012-06-22');
36 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`,`deleted`,`deleted_at`) VALUES (3,3,40.0,'2012-06-24',1,'2012-06-27 7:49');
37 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (1,3,70.0,'2012-06-27');
38 |
39 |
40 | -- Many to Many
41 |
42 | insert into `recipe_type` (`title`) VALUES ('type1');
43 | insert into `recipe_type` (`title`) VALUES ('type2');
44 | insert into `recipe_type` (`title`) VALUES ('type3');
45 | insert into `recipe_type` (`title`) VALUES ('type4');
46 | insert into `recipe_type` (`title`) VALUES ('type5');
47 |
48 | insert into `recipe_method` (`title`) VALUES ('method1');
49 | insert into `recipe_method` (`title`) VALUES ('method2');
50 | insert into `recipe_method` (`title`) VALUES ('method3');
51 | insert into `recipe_method` (`title`) VALUES ('method4');
52 | insert into `recipe_method` (`title`) VALUES ('method5');
53 |
54 | insert into `recipe` (`name`) VALUES ('recipe 1');
55 | insert into `recipe` (`name`) VALUES ('recipe 2');
56 | insert into `recipe` (`name`) VALUES ('recipe 3');
57 | insert into `recipe` (`name`) VALUES ('recipe 4');
58 | insert into `recipe` (`name`) VALUES ('recipe 5');
59 | insert into `recipe` (`name`) VALUES ('recipe 6');
60 | insert into `recipe` (`name`) VALUES ('recipe 7');
61 | insert into `recipe` (`name`) VALUES ('recipe 8');
62 | insert into `recipe` (`name`) VALUES ('recipe 9');
63 |
64 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (1,2);
65 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (1,4);
66 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (1,5);
67 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (2,3);
68 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (2,2);
69 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (2,1);
70 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (3,1);
71 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (3,2);
72 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (5,4);
73 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (6,5);
74 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (6,2);
75 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (7,4);
76 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (7,1);
77 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (7,3);
78 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (8,2);
79 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (9,2);
80 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (9,4);
81 |
82 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (1,2);
83 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (1,4);
84 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (2,5);
85 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (4,3);
86 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (5,1);
87 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (5,3);
88 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (5,5);
89 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (6,3);
90 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (6,4);
91 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (7,4);
92 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (8,1);
93 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (8,2);
94 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (8,3);
95 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (9,1);
96 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (9,2);
97 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (9,4);
98 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (9,5);
99 |
100 |
101 | -- One to One
102 |
103 | insert into `address` (`user_id`,`street`) VALUES (1,'South Lake');
104 | insert into `address` (`user_id`,`street`) VALUES (2,'Steep Hill');
105 | insert into `address` (`user_id`,`street`) VALUES (3,'Pine Woods');
106 |
107 | insert into `phone` (`user_id`,`mobile`) VALUES (2,'123-555-5555');
108 | insert into `phone` (`user_id`,`mobile`) VALUES (3,'456-555-5555');
109 |
110 | -- Many to One
111 |
112 | insert into `car` (`model`) VALUES ('Lamborghini Diablo');
113 | insert into `car` (`model`) VALUES ('Subaru Impreza');
114 | insert into `car` (`model`) VALUES ('Trabant');
115 |
116 | insert into `repair` (`car_id`,`date`) VALUES (1,'2013-01-13');
117 | insert into `repair` (`car_id`,`date`) VALUES (1,'2013-04-07');
118 | insert into `repair` (`car_id`,`date`) VALUES (2,'2013-02-15');
119 | insert into `repair` (`car_id`,`date`) VALUES (2,'2013-05-18');
120 | insert into `repair` (`car_id`,`date`) VALUES (3,'2013-03-12');
121 | insert into `repair` (`car_id`,`date`) VALUES (3,'2013-01-02');
122 |
123 | insert into `driver` (`car_id`,`name`) VALUES (1,'John');
124 | insert into `driver` (`car_id`,`name`) VALUES (1,'Ross');
125 | insert into `driver` (`car_id`,`name`) VALUES (2,'Ann');
126 | insert into `driver` (`car_id`,`name`) VALUES (2,'Patrick');
127 | insert into `driver` (`car_id`,`name`) VALUES (3,'David');
128 | insert into `driver` (`car_id`,`name`) VALUES (3,'Rossie');
129 |
130 |
131 | -- Controls
132 |
133 | -- otm
134 | insert into `controls_otm_single` (`name`) values ('one');
135 | insert into `controls_otm_single` (`name`) values ('two');
136 | insert into `controls_otm_single` (`name`) values ('three');
137 |
138 | insert into `controls_otm_multiple` (`first`,`last`) values ('one','two');
139 | insert into `controls_otm_multiple` (`first`) values ('three');
140 | insert into `controls_otm_multiple` (`first`,`last`) values ('four','five');
141 |
142 | insert into `controls_inline_otm_single` (`name`) values ('one');
143 | insert into `controls_inline_otm_single` (`name`) values ('two');
144 | insert into `controls_inline_otm_single` (`name`) values ('three');
145 |
146 | insert into `controls_inline_otm_multiple` (`first`,`last`) values ('one','two');
147 | insert into `controls_inline_otm_multiple` (`first`) values ('three');
148 | insert into `controls_inline_otm_multiple` (`first`,`last`) values ('four','five');
149 | -- mtm
150 | insert into `controls_mtm_single` (`name`) values ('one');
151 | insert into `controls_mtm_single` (`name`) values ('two');
152 | insert into `controls_mtm_single` (`name`) values ('three');
153 |
154 | insert into `controls_mtm_multiple` (`first`,`last`) values ('one','two');
155 | insert into `controls_mtm_multiple` (`first`) values ('three');
156 | insert into `controls_mtm_multiple` (`first`,`last`) values ('four','five');
157 |
158 | insert into `controls_inline_mtm_single` (`name`) values ('one');
159 | insert into `controls_inline_mtm_single` (`name`) values ('two');
160 | insert into `controls_inline_mtm_single` (`name`) values ('three');
161 |
162 | insert into `controls_inline_mtm_multiple` (`first`,`last`) values ('one','two');
163 | insert into `controls_inline_mtm_multiple` (`first`) values ('three');
164 | insert into `controls_inline_mtm_multiple` (`first`,`last`) values ('four','five');
165 | -- controls
166 | insert into `controls`
167 | (`controls_otm_single_id`,`controls_otm_multiple_id`,`static`,`text`,`boolean`,`bigint`,`double`,`upload`,`binary`,`date`,`time`,`datetime`,`textarea`)
168 | values (1,1,'two','text','1',150000,14.87,'file','','2013-12-10','20:36','2014-12-10 7:50','text');
169 | insert into `controls`
170 | (`text`)
171 | values ('all other empty');
172 | -- controls inline
173 | insert into `controls_inline`
174 | (`controls_id`,`controls_inline_otm_single_id`,`controls_inline_otm_multiple_id`,`static`,`text`,`boolean`,`bigint`,`double`,`upload`,`binary`,`date`,`time`,`datetime`,`year`,`textarea`)
175 | values (1,2,2,'three','text','1',1000000,15.50,'file','','2013-12-10','20:36','2014-12-10 7:50','2014','text');
176 | insert into `controls_inline`
177 | (`controls_id`,`controls_inline_otm_single_id`,`controls_inline_otm_multiple_id`,`static`,`text`,`boolean`,`bigint`,`double`,`upload`,`binary`,`date`,`time`,`datetime`,`year`,`textarea`)
178 | values (2,3,3,'one','text','0',900,16.67,'file','','2013-12-10','20:36','2014-12-10 7:50','2014','text');
179 | -- link
180 | insert into `controls_has_controls_mtm_single` (`controls_id`,`controls_mtm_single_id`) values (1,1);
181 | insert into `controls_has_controls_mtm_multiple` (`controls_id`,`controls_mtm_multiple_id`) values (1,1);
182 | insert into `controls_has_controls_mtm_multiple` (`controls_id`,`controls_mtm_multiple_id`) values (1,2);
183 | insert into `controls_has_controls_mtm_multiple` (`controls_id`,`controls_mtm_multiple_id`) values (1,3);
184 | insert into `controls_has_controls_mtm_single` (`controls_id`,`controls_mtm_single_id`) values (2,1);
185 | insert into `controls_has_controls_mtm_multiple` (`controls_id`,`controls_mtm_multiple_id`) values (2,1);
186 | insert into `controls_has_controls_mtm_multiple` (`controls_id`,`controls_mtm_multiple_id`) values (2,2);
187 | insert into `controls_has_controls_mtm_multiple` (`controls_id`,`controls_mtm_multiple_id`) values (2,3);
188 | -- link inline
189 | insert into `controls_inline_has_controls_inline_mtm_single` (`controls_inline_id`,`controls_inline_mtm_single_id`) values (1,1);
190 | insert into `controls_inline_has_controls_inline_mtm_multiple` (`controls_inline_id`,`controls_inline_mtm_multiple_id`) values (1,1);
191 | insert into `controls_inline_has_controls_inline_mtm_multiple` (`controls_inline_id`,`controls_inline_mtm_multiple_id`) values (1,2);
192 | insert into `controls_inline_has_controls_inline_mtm_multiple` (`controls_inline_id`,`controls_inline_mtm_multiple_id`) values (1,3);
193 | insert into `controls_inline_has_controls_inline_mtm_single` (`controls_inline_id`,`controls_inline_mtm_single_id`) values (2,1);
194 | insert into `controls_inline_has_controls_inline_mtm_multiple` (`controls_inline_id`,`controls_inline_mtm_multiple_id`) values (2,1);
195 | insert into `controls_inline_has_controls_inline_mtm_multiple` (`controls_inline_id`,`controls_inline_mtm_multiple_id`) values (2,2);
196 | insert into `controls_inline_has_controls_inline_mtm_multiple` (`controls_inline_id`,`controls_inline_mtm_multiple_id`) values (2,3);
197 | -- END Controls
198 |
--------------------------------------------------------------------------------
/fixtures/mysql/insert.sql:
--------------------------------------------------------------------------------
1 |
2 | SET FOREIGN_KEY_CHECKS=0;
3 |
4 | -- One to Many
5 | truncate table `user`;
6 | truncate table `item`;
7 | truncate table `purchase`;
8 |
9 | insert into `user` (`firstname`,`lastname`,`created_at`,`updated_at`) VALUES ('Jeff','Cox','2014-01-10 22:17:13','2014-01-10 22:17:13');
10 | insert into `user` (`firstname`,`lastname`,`created_at`,`updated_at`) VALUES ('Ann','Hart','2014-01-15 14:57:00','2014-01-15 14:57:00');
11 | insert into `user` (`firstname`,`lastname`,`created_at`,`updated_at`) VALUES ('Jack','Dean','2014-01-20 01:12:33','2014-01-20 01:12:33');
12 |
13 | insert into `item` (`name`,`image`) VALUES ('coffee','http://i.imgur.com/aRGnsmZ.jpg');
14 | insert into `item` (`name`,`image`) VALUES ('tea','http://i.imgur.com/Q4ifnMA.jpg');
15 | insert into `item` (`name`,`image`) VALUES ('energy','http://i.imgur.com/MmWBoOR.jpg');
16 | insert into `item` (`name`) VALUES ('cherries');
17 | insert into `item` (`name`) VALUES ('chocolate');
18 |
19 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (1,3,17.5,'2012-01-01');
20 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (2,1,37.5,'2012-01-12');
21 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (1,2,66.0,'2012-01-15');
22 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`,`deleted`,`deleted_at`) VALUES (4,3,15.0,'2012-01-27',1,'2012-03-01 1:15');
23 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (1,2,18.9,'2012-02-07');
24 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (2,1,100,'2012-02-19');
25 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (4,3,20.0,'2012-02-20');
26 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (2,3,50.0,'2012-03-08');
27 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (3,1,18.0,'2012-03-16');
28 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (5,2,9.00,'2012-03-18');
29 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (2,3,3.50,'2012-03-29');
30 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (5,1,19.0,'2012-04-09');
31 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (4,2,22.7,'2012-04-13');
32 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (3,3,44.5,'2012-04-21');
33 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`,`deleted`,`deleted_at`) VALUES (1,2,12.6,'2012-04-26',1,'2012-04-28 14:57');
34 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (2,2,16.0,'2012-04-26');
35 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (2,1,40.0,'2012-05-06');
36 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (3,2,16.8,'2012-05-15');
37 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (4,3,9.0,'2012-05-22');
38 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (2,1,40.0,'2012-06-06');
39 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (3,2,16.0,'2012-06-15');
40 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (5,3,19.0,'2012-06-22');
41 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`,`deleted`,`deleted_at`) VALUES (3,3,40.0,'2012-06-24',1,'2012-06-27 7:49');
42 | insert into `purchase` (`item_id`,`user_id`,`cache`,`date`) VALUES (1,3,70.0,'2012-06-27');
43 |
44 |
45 | -- Many to Many
46 | truncate table `recipe_type`;
47 | truncate table `recipe_method`;
48 | truncate table `recipe`;
49 | truncate table `recipe_has_recipe_types`;
50 | truncate table `recipe_has_recipe_methods`;
51 |
52 | insert into `recipe_type` (`title`) VALUES ('type1');
53 | insert into `recipe_type` (`title`) VALUES ('type2');
54 | insert into `recipe_type` (`title`) VALUES ('type3');
55 | insert into `recipe_type` (`title`) VALUES ('type4');
56 | insert into `recipe_type` (`title`) VALUES ('type5');
57 |
58 | insert into `recipe_method` (`title`) VALUES ('method1');
59 | insert into `recipe_method` (`title`) VALUES ('method2');
60 | insert into `recipe_method` (`title`) VALUES ('method3');
61 | insert into `recipe_method` (`title`) VALUES ('method4');
62 | insert into `recipe_method` (`title`) VALUES ('method5');
63 |
64 | insert into `recipe` (`name`) VALUES ('recipe 1');
65 | insert into `recipe` (`name`) VALUES ('recipe 2');
66 | insert into `recipe` (`name`) VALUES ('recipe 3');
67 | insert into `recipe` (`name`) VALUES ('recipe 4');
68 | insert into `recipe` (`name`) VALUES ('recipe 5');
69 | insert into `recipe` (`name`) VALUES ('recipe 6');
70 | insert into `recipe` (`name`) VALUES ('recipe 7');
71 | insert into `recipe` (`name`) VALUES ('recipe 8');
72 | insert into `recipe` (`name`) VALUES ('recipe 9');
73 |
74 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (1,2);
75 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (1,4);
76 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (1,5);
77 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (2,3);
78 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (2,2);
79 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (2,1);
80 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (3,1);
81 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (3,2);
82 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (5,4);
83 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (6,5);
84 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (6,2);
85 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (7,4);
86 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (7,1);
87 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (7,3);
88 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (8,2);
89 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (9,2);
90 | insert into `recipe_has_recipe_types` (`recipe_id`,`recipe_type_id`) VALUES (9,4);
91 |
92 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (1,2);
93 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (1,4);
94 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (2,5);
95 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (4,3);
96 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (5,1);
97 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (5,3);
98 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (5,5);
99 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (6,3);
100 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (6,4);
101 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (7,4);
102 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (8,1);
103 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (8,2);
104 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (8,3);
105 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (9,1);
106 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (9,2);
107 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (9,4);
108 | insert into `recipe_has_recipe_methods` (`recipe_id`,`recipe_method_id`) VALUES (9,5);
109 |
110 |
111 | -- One to One
112 | truncate table `address`;
113 | truncate table `phone`;
114 |
115 | insert into `address` (`user_id`,`street`) VALUES (1,'South Lake');
116 | insert into `address` (`user_id`,`street`) VALUES (2,'Steep Hill');
117 | insert into `address` (`user_id`,`street`) VALUES (3,'Pine Woods');
118 |
119 | insert into `phone` (`user_id`,`mobile`) VALUES (2,'123-555-5555');
120 | insert into `phone` (`user_id`,`mobile`) VALUES (3,'456-555-5555');
121 |
122 | -- Many to One
123 | truncate table `car`;
124 | truncate table `repair`;
125 | truncate table `driver`;
126 |
127 | insert into `car` (`model`) VALUES ('Lamborghini Diablo');
128 | insert into `car` (`model`) VALUES ('Subaru Impreza');
129 | insert into `car` (`model`) VALUES ('Trabant');
130 |
131 | insert into `repair` (`car_id`,`date`) VALUES (1,'2013-01-13');
132 | insert into `repair` (`car_id`,`date`) VALUES (1,'2013-04-07');
133 | insert into `repair` (`car_id`,`date`) VALUES (2,'2013-02-15');
134 | insert into `repair` (`car_id`,`date`) VALUES (2,'2013-05-18');
135 | insert into `repair` (`car_id`,`date`) VALUES (3,'2013-03-12');
136 | insert into `repair` (`car_id`,`date`) VALUES (3,'2013-01-02');
137 |
138 | insert into `driver` (`car_id`,`name`) VALUES (1,'John');
139 | insert into `driver` (`car_id`,`name`) VALUES (1,'Ross');
140 | insert into `driver` (`car_id`,`name`) VALUES (2,'Ann');
141 | insert into `driver` (`car_id`,`name`) VALUES (2,'Patrick');
142 | insert into `driver` (`car_id`,`name`) VALUES (3,'David');
143 | insert into `driver` (`car_id`,`name`) VALUES (3,'Rossie');
144 |
145 | -- Controls
146 | truncate table `controls_mtm_single`;
147 | truncate table `controls_mtm_multiple`;
148 | truncate table `controls_has_controls_mtm_single`;
149 | truncate table `controls_has_controls_mtm_multiple`;
150 | truncate table `controls`;
151 | truncate table `controls_otm_single`;
152 | truncate table `controls_otm_multiple`;
153 | truncate table `controls_inline_otm_single`;
154 | truncate table `controls_inline_otm_multiple`;
155 | -- otm
156 | insert into `controls_otm_single` (`name`) values ('one');
157 | insert into `controls_otm_single` (`name`) values ('two');
158 | insert into `controls_otm_single` (`name`) values ('three');
159 |
160 | insert into `controls_otm_multiple` (`first`,`last`) values ('one','two');
161 | insert into `controls_otm_multiple` (`first`) values ('three');
162 | insert into `controls_otm_multiple` (`first`,`last`) values ('four','five');
163 |
164 | insert into `controls_inline_otm_single` (`name`) values ('one');
165 | insert into `controls_inline_otm_single` (`name`) values ('two');
166 | insert into `controls_inline_otm_single` (`name`) values ('three');
167 |
168 | insert into `controls_inline_otm_multiple` (`first`,`last`) values ('one','two');
169 | insert into `controls_inline_otm_multiple` (`first`) values ('three');
170 | insert into `controls_inline_otm_multiple` (`first`,`last`) values ('four','five');
171 | -- mtm
172 | insert into `controls_mtm_single` (`name`) values ('one');
173 | insert into `controls_mtm_single` (`name`) values ('two');
174 | insert into `controls_mtm_single` (`name`) values ('three');
175 |
176 | insert into `controls_mtm_multiple` (`first`,`last`) values ('one','two');
177 | insert into `controls_mtm_multiple` (`first`) values ('three');
178 | insert into `controls_mtm_multiple` (`first`,`last`) values ('four','five');
179 |
180 | insert into `controls_inline_mtm_single` (`name`) values ('one');
181 | insert into `controls_inline_mtm_single` (`name`) values ('two');
182 | insert into `controls_inline_mtm_single` (`name`) values ('three');
183 |
184 | insert into `controls_inline_mtm_multiple` (`first`,`last`) values ('one','two');
185 | insert into `controls_inline_mtm_multiple` (`first`) values ('three');
186 | insert into `controls_inline_mtm_multiple` (`first`,`last`) values ('four','five');
187 | -- controls
188 | insert into `controls`
189 | (`controls_otm_single_id`,`controls_otm_multiple_id`,`static`,`text`,`boolean`,`bigint`,`double`,`upload`,`date`,`time`,`datetime`,`year`,`textarea`)
190 | values (1,1,'two','text',1,150000,14.87,'file','2013-12-10','20:36','2014-12-10 7:50','2015','text');
191 | insert into `controls`
192 | (`text`)
193 | values ('all other empty');
194 | -- controls inline
195 | insert into `controls_inline`
196 | (`controls_id`,`controls_inline_otm_single_id`,`controls_inline_otm_multiple_id`,`static`,`text`,`boolean`,`bigint`,`double`,`upload`,`date`,`time`,`datetime`,`year`,`textarea`)
197 | values (1,2,2,'three','text',1,1000000,15.50,'file','2013-12-10','20:36','2014-12-10 7:50','2015','text');
198 | insert into `controls_inline`
199 | (`controls_id`,`controls_inline_otm_single_id`,`controls_inline_otm_multiple_id`,`static`,`text`,`boolean`,`bigint`,`double`,`upload`,`date`,`time`,`datetime`,`year`,`textarea`)
200 | values (2,3,3,'one','text',0,900,16.67,'file','2013-12-10','20:36','2014-12-10 7:50','2015','text');
201 | -- link
202 | insert into `controls_has_controls_mtm_single` (`controls_id`,`controls_mtm_single_id`) values (1,1);
203 | insert into `controls_has_controls_mtm_multiple` (`controls_id`,`controls_mtm_multiple_id`) values (1,1);
204 | insert into `controls_has_controls_mtm_multiple` (`controls_id`,`controls_mtm_multiple_id`) values (1,2);
205 | insert into `controls_has_controls_mtm_multiple` (`controls_id`,`controls_mtm_multiple_id`) values (1,3);
206 | insert into `controls_has_controls_mtm_single` (`controls_id`,`controls_mtm_single_id`) values (2,1);
207 | insert into `controls_has_controls_mtm_multiple` (`controls_id`,`controls_mtm_multiple_id`) values (2,1);
208 | insert into `controls_has_controls_mtm_multiple` (`controls_id`,`controls_mtm_multiple_id`) values (2,2);
209 | insert into `controls_has_controls_mtm_multiple` (`controls_id`,`controls_mtm_multiple_id`) values (2,3);
210 | -- link inline
211 | insert into `controls_inline_has_controls_inline_mtm_single` (`controls_inline_id`,`controls_inline_mtm_single_id`) values (1,1);
212 | insert into `controls_inline_has_controls_inline_mtm_multiple` (`controls_inline_id`,`controls_inline_mtm_multiple_id`) values (1,1);
213 | insert into `controls_inline_has_controls_inline_mtm_multiple` (`controls_inline_id`,`controls_inline_mtm_multiple_id`) values (1,2);
214 | insert into `controls_inline_has_controls_inline_mtm_multiple` (`controls_inline_id`,`controls_inline_mtm_multiple_id`) values (1,3);
215 | insert into `controls_inline_has_controls_inline_mtm_single` (`controls_inline_id`,`controls_inline_mtm_single_id`) values (2,1);
216 | insert into `controls_inline_has_controls_inline_mtm_multiple` (`controls_inline_id`,`controls_inline_mtm_multiple_id`) values (2,1);
217 | insert into `controls_inline_has_controls_inline_mtm_multiple` (`controls_inline_id`,`controls_inline_mtm_multiple_id`) values (2,2);
218 | insert into `controls_inline_has_controls_inline_mtm_multiple` (`controls_inline_id`,`controls_inline_mtm_multiple_id`) values (2,3);
219 | -- END Controls
220 |
221 | SET FOREIGN_KEY_CHECKS=1;
222 |
--------------------------------------------------------------------------------
/fixtures/pg/insert.sql:
--------------------------------------------------------------------------------
1 |
2 | -- One to Many
3 | truncate table "user" restart identity cascade;
4 | truncate table "item" restart identity cascade;
5 | truncate table "purchase" restart identity cascade;
6 | alter sequence "item_id_seq" restart with 1;
7 | alter sequence "user_id_seq" restart with 1;
8 | alter sequence "purchase_id_seq" restart with 1;
9 |
10 | insert into "user" ("firstname","lastname","created_at","updated_at") VALUES ('Jeff','Cox','2014-01-10 22:17:13','2014-01-10 22:17:13');
11 | insert into "user" ("firstname","lastname","created_at","updated_at") VALUES ('Ann','Hart','2014-01-15 14:57:00','2014-01-15 14:57:00');
12 | insert into "user" ("firstname","lastname","created_at","updated_at") VALUES ('Jack','Dean','2014-01-20 01:12:33','2014-01-20 01:12:33');
13 |
14 | insert into "item" ("name","image") VALUES ('coffee','http://i.imgur.com/aRGnsmZ.jpg');
15 | insert into "item" ("name","image") VALUES ('tea','http://i.imgur.com/Q4ifnMA.jpg');
16 | insert into "item" ("name","image") VALUES ('energy','http://i.imgur.com/MmWBoOR.jpg');
17 | insert into "item" ("name") VALUES ('cherries');
18 | insert into "item" ("name") VALUES ('chocolate');
19 |
20 | insert into "purchase" ("item_id","user_id","cache","date") VALUES (1,3,17.5,'2012-01-01');
21 | insert into "purchase" ("item_id","user_id","cache","date") VALUES (2,1,37.5,'2012-01-12');
22 | insert into "purchase" ("item_id","user_id","cache","date") VALUES (1,2,66.0,'2012-01-15');
23 | insert into "purchase" ("item_id","user_id","cache","date","deleted","deleted_at") VALUES (4,3,15.0,'2012-01-27',true,'2012-03-01 1:15');
24 | insert into "purchase" ("item_id","user_id","cache","date") VALUES (1,2,18.9,'2012-02-07');
25 | insert into "purchase" ("item_id","user_id","cache","date") VALUES (2,1,100, '2012-02-19');
26 | insert into "purchase" ("item_id","user_id","cache","date") VALUES (4,3,20.0,'2012-02-20');
27 | insert into "purchase" ("item_id","user_id","cache","date") VALUES (2,3,50.0,'2012-03-08');
28 | insert into "purchase" ("item_id","user_id","cache","date") VALUES (3,1,18.0,'2012-03-16');
29 | insert into "purchase" ("item_id","user_id","cache","date") VALUES (5,2,9.00,'2012-03-18');
30 | insert into "purchase" ("item_id","user_id","cache","date") VALUES (2,3,3.50,'2012-03-29');
31 | insert into "purchase" ("item_id","user_id","cache","date") VALUES (5,1,19.0,'2012-04-09');
32 | insert into "purchase" ("item_id","user_id","cache","date") VALUES (4,2,22.7,'2012-04-13');
33 | insert into "purchase" ("item_id","user_id","cache","date") VALUES (3,3,44.5,'2012-04-21');
34 | insert into "purchase" ("item_id","user_id","cache","date","deleted","deleted_at") VALUES (1,2,12.6,'2012-04-26',true,'2012-04-28 14:57');
35 | insert into "purchase" ("item_id","user_id","cache","date") VALUES (2,2,16.0,'2012-04-26');
36 | insert into "purchase" ("item_id","user_id","cache","date") VALUES (2,1,40.0,'2012-05-06');
37 | insert into "purchase" ("item_id","user_id","cache","date") VALUES (3,2,16.8,'2012-05-15');
38 | insert into "purchase" ("item_id","user_id","cache","date") VALUES (4,3,9.0, '2012-05-22');
39 | insert into "purchase" ("item_id","user_id","cache","date") VALUES (2,1,40.0,'2012-06-06');
40 | insert into "purchase" ("item_id","user_id","cache","date") VALUES (3,2,16.0,'2012-06-15');
41 | insert into "purchase" ("item_id","user_id","cache","date") VALUES (5,3,19.0,'2012-06-22');
42 | insert into "purchase" ("item_id","user_id","cache","date","deleted","deleted_at") VALUES (3,3,40.0,'2012-06-24',true,'2012-06-27 7:49');
43 | insert into "purchase" ("item_id","user_id","cache","date") VALUES (1,3,70.0,'2012-06-27');
44 |
45 |
46 | -- Many to Many
47 | truncate table "recipe_type" restart identity cascade;
48 | truncate table "recipe_method" restart identity cascade;
49 | truncate table "recipe" restart identity cascade;
50 | truncate table "recipe_has_recipe_types" restart identity cascade;
51 | truncate table "recipe_has_recipe_methods" restart identity cascade;
52 | alter sequence "recipe_id_seq" restart with 1;
53 | alter sequence "recipe_type_id_seq" restart with 1;
54 | alter sequence "recipe_method_id_seq" restart with 1;
55 |
56 | insert into "recipe_type" ("title") VALUES ('type1');
57 | insert into "recipe_type" ("title") VALUES ('type2');
58 | insert into "recipe_type" ("title") VALUES ('type3');
59 | insert into "recipe_type" ("title") VALUES ('type4');
60 | insert into "recipe_type" ("title") VALUES ('type5');
61 |
62 | insert into "recipe_method" ("title") VALUES ('method1');
63 | insert into "recipe_method" ("title") VALUES ('method2');
64 | insert into "recipe_method" ("title") VALUES ('method3');
65 | insert into "recipe_method" ("title") VALUES ('method4');
66 | insert into "recipe_method" ("title") VALUES ('method5');
67 |
68 | insert into "recipe" ("name") VALUES ('recipe 1');
69 | insert into "recipe" ("name") VALUES ('recipe 2');
70 | insert into "recipe" ("name") VALUES ('recipe 3');
71 | insert into "recipe" ("name") VALUES ('recipe 4');
72 | insert into "recipe" ("name") VALUES ('recipe 5');
73 | insert into "recipe" ("name") VALUES ('recipe 6');
74 | insert into "recipe" ("name") VALUES ('recipe 7');
75 | insert into "recipe" ("name") VALUES ('recipe 8');
76 | insert into "recipe" ("name") VALUES ('recipe 9');
77 |
78 | insert into "recipe_has_recipe_types" ("recipe_id","recipe_type_id") VALUES (1,2);
79 | insert into "recipe_has_recipe_types" ("recipe_id","recipe_type_id") VALUES (1,4);
80 | insert into "recipe_has_recipe_types" ("recipe_id","recipe_type_id") VALUES (1,5);
81 | insert into "recipe_has_recipe_types" ("recipe_id","recipe_type_id") VALUES (2,3);
82 | insert into "recipe_has_recipe_types" ("recipe_id","recipe_type_id") VALUES (2,2);
83 | insert into "recipe_has_recipe_types" ("recipe_id","recipe_type_id") VALUES (2,1);
84 | insert into "recipe_has_recipe_types" ("recipe_id","recipe_type_id") VALUES (3,1);
85 | insert into "recipe_has_recipe_types" ("recipe_id","recipe_type_id") VALUES (3,2);
86 | insert into "recipe_has_recipe_types" ("recipe_id","recipe_type_id") VALUES (5,4);
87 | insert into "recipe_has_recipe_types" ("recipe_id","recipe_type_id") VALUES (6,5);
88 | insert into "recipe_has_recipe_types" ("recipe_id","recipe_type_id") VALUES (6,2);
89 | insert into "recipe_has_recipe_types" ("recipe_id","recipe_type_id") VALUES (7,4);
90 | insert into "recipe_has_recipe_types" ("recipe_id","recipe_type_id") VALUES (7,1);
91 | insert into "recipe_has_recipe_types" ("recipe_id","recipe_type_id") VALUES (7,3);
92 | insert into "recipe_has_recipe_types" ("recipe_id","recipe_type_id") VALUES (8,2);
93 | insert into "recipe_has_recipe_types" ("recipe_id","recipe_type_id") VALUES (9,2);
94 | insert into "recipe_has_recipe_types" ("recipe_id","recipe_type_id") VALUES (9,4);
95 |
96 | insert into "recipe_has_recipe_methods" ("recipe_id","recipe_method_id") VALUES (1,2);
97 | insert into "recipe_has_recipe_methods" ("recipe_id","recipe_method_id") VALUES (1,4);
98 | insert into "recipe_has_recipe_methods" ("recipe_id","recipe_method_id") VALUES (2,5);
99 | insert into "recipe_has_recipe_methods" ("recipe_id","recipe_method_id") VALUES (4,3);
100 | insert into "recipe_has_recipe_methods" ("recipe_id","recipe_method_id") VALUES (5,1);
101 | insert into "recipe_has_recipe_methods" ("recipe_id","recipe_method_id") VALUES (5,3);
102 | insert into "recipe_has_recipe_methods" ("recipe_id","recipe_method_id") VALUES (5,5);
103 | insert into "recipe_has_recipe_methods" ("recipe_id","recipe_method_id") VALUES (6,3);
104 | insert into "recipe_has_recipe_methods" ("recipe_id","recipe_method_id") VALUES (6,4);
105 | insert into "recipe_has_recipe_methods" ("recipe_id","recipe_method_id") VALUES (7,4);
106 | insert into "recipe_has_recipe_methods" ("recipe_id","recipe_method_id") VALUES (8,1);
107 | insert into "recipe_has_recipe_methods" ("recipe_id","recipe_method_id") VALUES (8,2);
108 | insert into "recipe_has_recipe_methods" ("recipe_id","recipe_method_id") VALUES (8,3);
109 | insert into "recipe_has_recipe_methods" ("recipe_id","recipe_method_id") VALUES (9,1);
110 | insert into "recipe_has_recipe_methods" ("recipe_id","recipe_method_id") VALUES (9,2);
111 | insert into "recipe_has_recipe_methods" ("recipe_id","recipe_method_id") VALUES (9,4);
112 | insert into "recipe_has_recipe_methods" ("recipe_id","recipe_method_id") VALUES (9,5);
113 |
114 |
115 | -- One to One
116 | truncate table "address" restart identity cascade;
117 | truncate table "phone" restart identity cascade;
118 | alter sequence "address_id_seq" restart with 1;
119 | alter sequence "phone_id_seq" restart with 1;
120 |
121 | insert into "address" ("user_id","street") VALUES (1,'South Lake');
122 | insert into "address" ("user_id","street") VALUES (2,'Steep Hill');
123 | insert into "address" ("user_id","street") VALUES (3,'Pine Woods');
124 |
125 | insert into "phone" ("user_id","mobile") VALUES (2,'123-555-5555');
126 | insert into "phone" ("user_id","mobile") VALUES (3,'456-555-5555');
127 |
128 | -- Many to One
129 | truncate table "car" restart identity cascade;
130 | truncate table "repair" restart identity cascade;
131 | truncate table "driver" restart identity cascade;
132 | alter sequence "car_id_seq" restart with 1;
133 | alter sequence "repair_id_seq" restart with 1;
134 | alter sequence "driver_id_seq" restart with 1;
135 |
136 | insert into "car" ("model") VALUES ('Lamborghini Diablo');
137 | insert into "car" ("model") VALUES ('Subaru Impreza');
138 | insert into "car" ("model") VALUES ('Trabant');
139 |
140 | insert into "repair" ("car_id","date") VALUES (1,'2013-01-13');
141 | insert into "repair" ("car_id","date") VALUES (1,'2013-04-07');
142 | insert into "repair" ("car_id","date") VALUES (2,'2013-02-15');
143 | insert into "repair" ("car_id","date") VALUES (2,'2013-05-18');
144 | insert into "repair" ("car_id","date") VALUES (3,'2013-03-12');
145 | insert into "repair" ("car_id","date") VALUES (3,'2013-01-02');
146 |
147 | insert into "driver" ("car_id","name") VALUES (1,'John');
148 | insert into "driver" ("car_id","name") VALUES (1,'Ross');
149 | insert into "driver" ("car_id","name") VALUES (2,'Ann');
150 | insert into "driver" ("car_id","name") VALUES (2,'Patrick');
151 | insert into "driver" ("car_id","name") VALUES (3,'David');
152 | insert into "driver" ("car_id","name") VALUES (3,'Rossie');
153 |
154 | -- Controls
155 | truncate table "controls_mtm_single" restart identity cascade;
156 | truncate table "controls_mtm_multiple" restart identity cascade;
157 |
158 | truncate table "controls_has_controls_mtm_single" restart identity cascade;
159 | truncate table "controls_has_controls_mtm_multiple" restart identity cascade;
160 |
161 | truncate table "controls" restart identity cascade;
162 |
163 | truncate table "controls_otm_single" restart identity cascade;
164 | truncate table "controls_otm_multiple" restart identity cascade;
165 |
166 |
167 | truncate table "controls_inline_mtm_single" restart identity cascade;
168 | truncate table "controls_inline_mtm_multiple" restart identity cascade;
169 |
170 | truncate table "controls_inline_has_controls_inline_mtm_single" restart identity cascade;
171 | truncate table "controls_inline_has_controls_inline_mtm_multiple" restart identity cascade;
172 |
173 | truncate table "controls_inline" restart identity cascade;
174 |
175 | truncate table "controls_inline_otm_single" restart identity cascade;
176 | truncate table "controls_inline_otm_multiple" restart identity cascade;
177 |
178 |
179 |
180 |
181 | alter sequence "controls_otm_single_id_seq" restart with 1;
182 | alter sequence "controls_otm_multiple_id_seq" restart with 1;
183 |
184 | alter sequence "controls_id_seq" restart with 1;
185 |
186 | alter sequence "controls_mtm_single_id_seq" restart with 1;
187 | alter sequence "controls_mtm_multiple_id_seq" restart with 1;
188 |
189 | alter sequence "controls_inline_otm_single_id_seq" restart with 1;
190 | alter sequence "controls_inline_otm_multiple_id_seq" restart with 1;
191 |
192 | alter sequence "controls_inline_id_seq" restart with 1;
193 |
194 | alter sequence "controls_inline_mtm_single_id_seq" restart with 1;
195 | alter sequence "controls_inline_mtm_multiple_id_seq" restart with 1;
196 |
197 | -- otm
198 | insert into "controls_otm_single" ("name") values ('one');
199 | insert into "controls_otm_single" ("name") values ('two');
200 | insert into "controls_otm_single" ("name") values ('three');
201 |
202 | insert into "controls_otm_multiple" ("first","last") values ('one','two');
203 | insert into "controls_otm_multiple" ("first") values ('three');
204 | insert into "controls_otm_multiple" ("first","last") values ('four','five');
205 |
206 | insert into "controls_inline_otm_single" ("name") values ('one');
207 | insert into "controls_inline_otm_single" ("name") values ('two');
208 | insert into "controls_inline_otm_single" ("name") values ('three');
209 |
210 | insert into "controls_inline_otm_multiple" ("first","last") values ('one','two');
211 | insert into "controls_inline_otm_multiple" ("first") values ('three');
212 | insert into "controls_inline_otm_multiple" ("first","last") values ('four','five');
213 | -- mtm
214 | insert into "controls_mtm_single" ("name") values ('one');
215 | insert into "controls_mtm_single" ("name") values ('two');
216 | insert into "controls_mtm_single" ("name") values ('three');
217 |
218 | insert into "controls_mtm_multiple" ("first","last") values ('one','two');
219 | insert into "controls_mtm_multiple" ("first") values ('three');
220 | insert into "controls_mtm_multiple" ("first","last") values ('four','five');
221 |
222 | insert into "controls_inline_mtm_single" ("name") values ('one');
223 | insert into "controls_inline_mtm_single" ("name") values ('two');
224 | insert into "controls_inline_mtm_single" ("name") values ('three');
225 |
226 | insert into "controls_inline_mtm_multiple" ("first","last") values ('one','two');
227 | insert into "controls_inline_mtm_multiple" ("first") values ('three');
228 | insert into "controls_inline_mtm_multiple" ("first","last") values ('four','five');
229 | -- controls
230 | insert into "controls"
231 | ("controls_otm_single_id","controls_otm_multiple_id","static","text","boolean","upload","binary","date","time","datetime","textarea")
232 | values (1,1,'two','text','1','file','','2013-12-10','20:36','2014-12-10 7:50','text');
233 | insert into "controls"
234 | ("text")
235 | values ('all other empty');
236 | -- controls inline
237 | insert into "controls_inline"
238 | ("controls_id","controls_inline_otm_single_id","controls_inline_otm_multiple_id","static","text","boolean","bigint","double","upload","binary","date","time","datetime","textarea")
239 | values (1,2,2,'three','text','1',1000000,15.50,'file','','2013-12-10','20:36','2014-12-10 7:50','text');
240 | insert into "controls_inline"
241 | ("controls_id","controls_inline_otm_single_id","controls_inline_otm_multiple_id","static","text","boolean","bigint","double","upload","binary","date","time","datetime","textarea")
242 | values (2,3,3,'one','text','0',900,16.67,'file','','2013-12-10','20:36','2014-12-10 7:50','text');
243 | -- link
244 | insert into "controls_has_controls_mtm_single" ("controls_id","controls_mtm_single_id") values (1,1);
245 | insert into "controls_has_controls_mtm_multiple" ("controls_id","controls_mtm_multiple_id") values (1,1);
246 | insert into "controls_has_controls_mtm_multiple" ("controls_id","controls_mtm_multiple_id") values (1,2);
247 | insert into "controls_has_controls_mtm_multiple" ("controls_id","controls_mtm_multiple_id") values (1,3);
248 | insert into "controls_has_controls_mtm_single" ("controls_id","controls_mtm_single_id") values (2,1);
249 | insert into "controls_has_controls_mtm_multiple" ("controls_id","controls_mtm_multiple_id") values (2,1);
250 | insert into "controls_has_controls_mtm_multiple" ("controls_id","controls_mtm_multiple_id") values (2,2);
251 | insert into "controls_has_controls_mtm_multiple" ("controls_id","controls_mtm_multiple_id") values (2,3);
252 | -- link inline
253 | insert into "controls_inline_has_controls_inline_mtm_single" ("controls_inline_id","controls_inline_mtm_single_id") values (1,1);
254 | insert into "controls_inline_has_controls_inline_mtm_multiple" ("controls_inline_id","controls_inline_mtm_multiple_id") values (1,1);
255 | insert into "controls_inline_has_controls_inline_mtm_multiple" ("controls_inline_id","controls_inline_mtm_multiple_id") values (1,2);
256 | insert into "controls_inline_has_controls_inline_mtm_multiple" ("controls_inline_id","controls_inline_mtm_multiple_id") values (1,3);
257 | insert into "controls_inline_has_controls_inline_mtm_single" ("controls_inline_id","controls_inline_mtm_single_id") values (2,1);
258 | insert into "controls_inline_has_controls_inline_mtm_multiple" ("controls_inline_id","controls_inline_mtm_multiple_id") values (2,1);
259 | insert into "controls_inline_has_controls_inline_mtm_multiple" ("controls_inline_id","controls_inline_mtm_multiple_id") values (2,2);
260 | insert into "controls_inline_has_controls_inline_mtm_multiple" ("controls_inline_id","controls_inline_mtm_multiple_id") values (2,3);
261 | -- END Controls
262 |
--------------------------------------------------------------------------------
/fixtures/pg/schema.sql:
--------------------------------------------------------------------------------
1 |
2 | DROP SCHEMA IF EXISTS "x-admin-examples" ;
3 | CREATE SCHEMA IF NOT EXISTS "x-admin-examples";
4 |
5 |
6 | ALTER TABLE "purchase" DROP CONSTRAINT "item_id";
7 | ALTER TABLE "purchase" DROP CONSTRAINT "user_id";
8 | ALTER TABLE "recipe_has_recipe_types" DROP CONSTRAINT "recipe_id";
9 | ALTER TABLE "recipe_has_recipe_types" DROP CONSTRAINT "recipe_type_id";
10 | ALTER TABLE "recipe_has_recipe_methods" DROP CONSTRAINT "recipe_id";
11 | ALTER TABLE "recipe_has_recipe_methods" DROP CONSTRAINT "recipe_method_id";
12 | ALTER TABLE "address" DROP CONSTRAINT "user_id";
13 | ALTER TABLE "phone" DROP CONSTRAINT "user_id";
14 | ALTER TABLE "repair" DROP CONSTRAINT "car_id";
15 | ALTER TABLE "driver" DROP CONSTRAINT "car_id";
16 |
17 | ALTER TABLE "controls" DROP CONSTRAINT "controls_otm_single_id";
18 | ALTER TABLE "controls" DROP CONSTRAINT "controls_otm_multiple_id";
19 |
20 | ALTER TABLE "controls_has_controls_mtm_single" DROP CONSTRAINT "controls_id";
21 | ALTER TABLE "controls_has_controls_mtm_single" DROP CONSTRAINT "controls_mtm_single_id";
22 | ALTER TABLE "controls_has_controls_mtm_multiple" DROP CONSTRAINT "controls_id";
23 | ALTER TABLE "controls_has_controls_mtm_multiple" DROP CONSTRAINT "controls_mtm_multiple_id";
24 |
25 | ALTER TABLE "controls_inline" DROP CONSTRAINT "controls_inline_otm_single_id";
26 | ALTER TABLE "controls_inline" DROP CONSTRAINT "controls_inline_otm_multiple_id";
27 | ALTER TABLE "controls_inline" DROP CONSTRAINT "controls_id";
28 |
29 | ALTER TABLE "controls_inline_has_controls_inline_mtm_single" DROP CONSTRAINT "controls_inline_id";
30 | ALTER TABLE "controls_inline_has_controls_inline_mtm_single" DROP CONSTRAINT "controls_inline_mtm_single_id";
31 | ALTER TABLE "controls_inline_has_controls_inline_mtm_multiple" DROP CONSTRAINT "controls_inline_id";
32 | ALTER TABLE "controls_inline_has_controls_inline_mtm_multiple" DROP CONSTRAINT "controls_inline_mtm_multiple_id";
33 |
34 |
35 | -- -----------------------------------------------------
36 | -- Table "notes"
37 | -- -----------------------------------------------------
38 | DROP TABLE IF EXISTS "notes" ;
39 | CREATE SEQUENCE notes_id_seq;
40 |
41 | CREATE TABLE IF NOT EXISTS "notes" (
42 | "id" INT NOT NULL DEFAULT nextval('notes_id_seq') ,
43 | "notes1" TEXT NULL ,
44 | "notes2" TEXT NOT NULL ,
45 | "notes3" TEXT NULL ,
46 | "notes4" TEXT NOT NULL ,
47 | PRIMARY KEY ("id") );
48 |
49 |
50 | -- -----------------------------------------------------
51 | -- Table "item"
52 | -- -----------------------------------------------------
53 | DROP TABLE IF EXISTS "item" ;
54 | CREATE SEQUENCE item_id_seq;
55 |
56 | CREATE TABLE IF NOT EXISTS "item" (
57 | "id" INT NOT NULL DEFAULT nextval('item_id_seq') ,
58 | "name" VARCHAR(45) NOT NULL ,
59 | "description" TEXT NULL ,
60 | "image" VARCHAR(255) NULL ,
61 | PRIMARY KEY ("id") );
62 |
63 |
64 | -- -----------------------------------------------------
65 | -- Table "user"
66 | -- -----------------------------------------------------
67 | DROP TABLE IF EXISTS "user" ;
68 | CREATE SEQUENCE user_id_seq;
69 |
70 | CREATE TABLE IF NOT EXISTS "user" (
71 | "id" INT NOT NULL DEFAULT nextval('user_id_seq') ,
72 | "firstname" VARCHAR(45) NOT NULL ,
73 | "lastname" VARCHAR(45) NULL ,
74 | "created_at" TIMESTAMP NOT NULL ,
75 | "updated_at" TIMESTAMP NOT NULL ,
76 | PRIMARY KEY ("id") );
77 |
78 |
79 | -- -----------------------------------------------------
80 | -- Table "purchase"
81 | -- -----------------------------------------------------
82 | DROP TABLE IF EXISTS "purchase" ;
83 | CREATE SEQUENCE purchase_id_seq;
84 |
85 | CREATE TABLE IF NOT EXISTS "purchase" (
86 | "id" INT NOT NULL DEFAULT nextval('purchase_id_seq') ,
87 | "item_id" INT NOT NULL ,
88 | "user_id" INT NULL ,
89 | "cache" DECIMAL(6,2) NOT NULL ,
90 | "date" DATE NULL ,
91 | "deleted" BOOLEAN NULL,
92 | "deleted_at" TIMESTAMP NULL,
93 | PRIMARY KEY ("id") ,
94 |
95 | CONSTRAINT "item_id"
96 | FOREIGN KEY ("item_id" )
97 | REFERENCES "item" ("id" )
98 | ON DELETE NO ACTION
99 | ON UPDATE NO ACTION,
100 | CONSTRAINT "user_id"
101 | FOREIGN KEY ("user_id" )
102 | REFERENCES "user" ("id" )
103 | ON DELETE NO ACTION
104 | ON UPDATE NO ACTION);
105 |
106 |
107 | -- -----------------------------------------------------
108 | -- Table "recipe"
109 | -- -----------------------------------------------------
110 | DROP TABLE IF EXISTS "recipe" ;
111 | CREATE SEQUENCE recipe_id_seq;
112 |
113 | CREATE TABLE IF NOT EXISTS "recipe" (
114 | "id" INT NOT NULL DEFAULT nextval('recipe_id_seq') ,
115 | "name" VARCHAR(45) NOT NULL ,
116 | PRIMARY KEY ("id") );
117 |
118 |
119 | -- -----------------------------------------------------
120 | -- Table "recipe_type"
121 | -- -----------------------------------------------------
122 | DROP TABLE IF EXISTS "recipe_type" ;
123 | CREATE SEQUENCE recipe_type_id_seq;
124 |
125 | CREATE TABLE IF NOT EXISTS "recipe_type" (
126 | "id" INT NOT NULL DEFAULT nextval('recipe_type_id_seq') ,
127 | "title" VARCHAR(45) NOT NULL ,
128 | PRIMARY KEY ("id") );
129 |
130 |
131 | -- -----------------------------------------------------
132 | -- Table "recipe_method"
133 | -- -----------------------------------------------------
134 | DROP TABLE IF EXISTS "recipe_method" ;
135 | CREATE SEQUENCE recipe_method_id_seq;
136 |
137 | CREATE TABLE IF NOT EXISTS "recipe_method" (
138 | "id" INT NOT NULL DEFAULT nextval('recipe_method_id_seq') ,
139 | "title" VARCHAR(45) NOT NULL ,
140 | PRIMARY KEY ("id") );
141 |
142 |
143 | -- -----------------------------------------------------
144 | -- Table "recipe_has_recipe_types"
145 | -- -----------------------------------------------------
146 | DROP TABLE IF EXISTS "recipe_has_recipe_types" ;
147 |
148 | CREATE TABLE IF NOT EXISTS "recipe_has_recipe_types" (
149 | "recipe_id" INT NOT NULL ,
150 | "recipe_type_id" INT NOT NULL ,
151 | PRIMARY KEY ("recipe_id", "recipe_type_id") ,
152 |
153 | CONSTRAINT "recipe_type_id"
154 | FOREIGN KEY ("recipe_id" )
155 | REFERENCES "recipe" ("id" )
156 | ON DELETE NO ACTION
157 | ON UPDATE NO ACTION,
158 | CONSTRAINT "recipe_id"
159 | FOREIGN KEY ("recipe_type_id" )
160 | REFERENCES "recipe_type" ("id" )
161 | ON DELETE NO ACTION
162 | ON UPDATE NO ACTION);
163 |
164 |
165 | -- -----------------------------------------------------
166 | -- Table "recipe_has_recipe_methods"
167 | -- -----------------------------------------------------
168 | DROP TABLE IF EXISTS "recipe_has_recipe_methods" ;
169 |
170 | CREATE TABLE IF NOT EXISTS "recipe_has_recipe_methods" (
171 | "recipe_id" INT NOT NULL ,
172 | "recipe_method_id" INT NOT NULL ,
173 | PRIMARY KEY ("recipe_id", "recipe_method_id") ,
174 |
175 | CONSTRAINT "recipe_method_id"
176 | FOREIGN KEY ("recipe_id" )
177 | REFERENCES "recipe" ("id" )
178 | ON DELETE NO ACTION
179 | ON UPDATE NO ACTION,
180 | CONSTRAINT "recipe_id"
181 | FOREIGN KEY ("recipe_method_id" )
182 | REFERENCES "recipe_method" ("id" )
183 | ON DELETE NO ACTION
184 | ON UPDATE NO ACTION);
185 |
186 |
187 | -- -----------------------------------------------------
188 | -- Table "address"
189 | -- -----------------------------------------------------
190 | DROP TABLE IF EXISTS "address" ;
191 | CREATE SEQUENCE address_id_seq;
192 |
193 | CREATE TABLE IF NOT EXISTS "address" (
194 | "id" INT NOT NULL DEFAULT nextval('address_id_seq') ,
195 | "user_id" INT NOT NULL ,
196 | "street" VARCHAR(45) NOT NULL ,
197 | PRIMARY KEY ("id") ,
198 |
199 | CONSTRAINT "user_id"
200 | FOREIGN KEY ("user_id" )
201 | REFERENCES "user" ("id" )
202 | ON DELETE NO ACTION
203 | ON UPDATE NO ACTION);
204 |
205 |
206 | -- -----------------------------------------------------
207 | -- Table "phone"
208 | -- -----------------------------------------------------
209 | DROP TABLE IF EXISTS "phone" ;
210 | CREATE SEQUENCE phone_id_seq;
211 |
212 | CREATE TABLE IF NOT EXISTS "phone" (
213 | "id" INT NOT NULL DEFAULT nextval('phone_id_seq') ,
214 | "user_id" INT NOT NULL ,
215 | "mobile" VARCHAR(45) NOT NULL ,
216 | PRIMARY KEY ("id") ,
217 |
218 | CONSTRAINT "user_id"
219 | FOREIGN KEY ("user_id" )
220 | REFERENCES "user" ("id" )
221 | ON DELETE NO ACTION
222 | ON UPDATE NO ACTION);
223 |
224 |
225 | -- -----------------------------------------------------
226 | -- Table "car"
227 | -- -----------------------------------------------------
228 | DROP TABLE IF EXISTS "car" ;
229 | CREATE SEQUENCE car_id_seq;
230 |
231 | CREATE TABLE IF NOT EXISTS "car" (
232 | "id" INT NOT NULL DEFAULT nextval('car_id_seq') ,
233 | "model" VARCHAR(45) NOT NULL ,
234 | PRIMARY KEY ("id") );
235 |
236 |
237 | -- -----------------------------------------------------
238 | -- Table "repair"
239 | -- -----------------------------------------------------
240 | DROP TABLE IF EXISTS "repair" ;
241 | CREATE SEQUENCE repair_id_seq;
242 |
243 | CREATE TABLE IF NOT EXISTS "repair" (
244 | "id" INT NOT NULL DEFAULT nextval('repair_id_seq') ,
245 | "car_id" INT NOT NULL ,
246 | "date" DATE NOT NULL ,
247 | PRIMARY KEY ("id") ,
248 | CONSTRAINT "car_id"
249 | FOREIGN KEY ("car_id" )
250 | REFERENCES "car" ("id" )
251 | ON DELETE NO ACTION
252 | ON UPDATE NO ACTION);
253 |
254 |
255 | -- -----------------------------------------------------
256 | -- Table "driver"
257 | -- -----------------------------------------------------
258 | DROP TABLE IF EXISTS "driver" ;
259 | CREATE SEQUENCE driver_id_seq;
260 |
261 | CREATE TABLE IF NOT EXISTS "driver" (
262 | "id" INT NOT NULL DEFAULT nextval('driver_id_seq') ,
263 | "car_id" INT NOT NULL ,
264 | "name" VARCHAR(45) NOT NULL ,
265 | PRIMARY KEY ("id") ,
266 | CONSTRAINT "car_id"
267 | FOREIGN KEY ("car_id" )
268 | REFERENCES "car" ("id" )
269 | ON DELETE NO ACTION
270 | ON UPDATE NO ACTION);
271 |
272 |
273 | -- -----------------------------------------------------
274 | -- Table "controls_otm_single"
275 | -- -----------------------------------------------------
276 | DROP TABLE IF EXISTS "controls_otm_single" ;
277 | CREATE SEQUENCE controls_otm_single_id_seq;
278 |
279 | CREATE TABLE IF NOT EXISTS "controls_otm_single" (
280 | "id" INT NOT NULL DEFAULT nextval('controls_otm_single_id_seq'),
281 | "name" VARCHAR(45) NOT NULL,
282 | PRIMARY KEY ("id"));
283 |
284 |
285 | -- -----------------------------------------------------
286 | -- Table "controls_otm_multiple"
287 | -- -----------------------------------------------------
288 | DROP TABLE IF EXISTS "controls_otm_multiple" ;
289 | CREATE SEQUENCE controls_otm_multiple_id_seq;
290 |
291 | CREATE TABLE IF NOT EXISTS "controls_otm_multiple" (
292 | "id" INT NOT NULL DEFAULT nextval('controls_otm_multiple_id_seq'),
293 | "first" VARCHAR(45) NOT NULL,
294 | "last" VARCHAR(45) NULL,
295 | PRIMARY KEY ("id"));
296 |
297 |
298 | -- -----------------------------------------------------
299 | -- Table "controls"
300 | -- -----------------------------------------------------
301 | DROP TABLE IF EXISTS "controls" ;
302 | CREATE SEQUENCE controls_id_seq;
303 |
304 | CREATE TABLE IF NOT EXISTS "controls" (
305 | "id" INT NOT NULL DEFAULT nextval('controls_id_seq'),
306 | "controls_otm_single_id" INT NULL,
307 | "controls_otm_multiple_id" INT NULL,
308 | "static" VARCHAR(45) NULL,
309 | "text" VARCHAR(45) NULL,
310 | "boolean" BOOLEAN NULL,
311 | "bigint" BIGINT NULL,
312 | "double" DOUBLE PRECISION NULL,
313 | "upload" VARCHAR(45) NULL,
314 | "binary" BYTEA NULL,
315 | "date" DATE NULL,
316 | "time" TIME NULL,
317 | "datetime" TIMESTAMP NULL,
318 | "textarea" TEXT NULL,
319 | PRIMARY KEY ("id"),
320 | CONSTRAINT "controls_otm_single_id"
321 | FOREIGN KEY ("controls_otm_single_id")
322 | REFERENCES "controls_otm_single" ("id")
323 | ON DELETE NO ACTION
324 | ON UPDATE NO ACTION,
325 | CONSTRAINT "controls_otm_multiple_id"
326 | FOREIGN KEY ("controls_otm_multiple_id")
327 | REFERENCES "controls_otm_multiple" ("id")
328 | ON DELETE NO ACTION
329 | ON UPDATE NO ACTION);
330 |
331 |
332 | -- -----------------------------------------------------
333 | -- Table "controls_mtm_single"
334 | -- -----------------------------------------------------
335 | DROP TABLE IF EXISTS "controls_mtm_single" ;
336 | CREATE SEQUENCE controls_mtm_single_id_seq;
337 |
338 | CREATE TABLE IF NOT EXISTS "controls_mtm_single" (
339 | "id" INT NOT NULL DEFAULT nextval('controls_mtm_single_id_seq'),
340 | "name" VARCHAR(45) NOT NULL,
341 | PRIMARY KEY ("id"));
342 |
343 |
344 | -- -----------------------------------------------------
345 | -- Table "controls_mtm_multiple"
346 | -- -----------------------------------------------------
347 | DROP TABLE IF EXISTS "controls_mtm_multiple" ;
348 | CREATE SEQUENCE controls_mtm_multiple_id_seq;
349 |
350 | CREATE TABLE IF NOT EXISTS "controls_mtm_multiple" (
351 | "id" INT NOT NULL DEFAULT nextval('controls_mtm_multiple_id_seq'),
352 | "first" VARCHAR(45) NOT NULL,
353 | "last" VARCHAR(45) NULL,
354 | PRIMARY KEY ("id"));
355 |
356 |
357 | -- -----------------------------------------------------
358 | -- Table "controls_has_controls_mtm_single"
359 | -- -----------------------------------------------------
360 | DROP TABLE IF EXISTS "controls_has_controls_mtm_single" ;
361 |
362 | CREATE TABLE IF NOT EXISTS "controls_has_controls_mtm_single" (
363 | "controls_id" INT NOT NULL,
364 | "controls_mtm_single_id" INT NOT NULL,
365 | PRIMARY KEY ("controls_id", "controls_mtm_single_id"),
366 | CONSTRAINT "controls_id"
367 | FOREIGN KEY ("controls_id")
368 | REFERENCES "controls" ("id")
369 | ON DELETE NO ACTION
370 | ON UPDATE NO ACTION,
371 | CONSTRAINT "controls_mtm_single_id"
372 | FOREIGN KEY ("controls_mtm_single_id")
373 | REFERENCES "controls_mtm_single" ("id")
374 | ON DELETE NO ACTION
375 | ON UPDATE NO ACTION);
376 |
377 |
378 | -- -----------------------------------------------------
379 | -- Table "controls_has_controls_mtm_multiple"
380 | -- -----------------------------------------------------
381 | DROP TABLE IF EXISTS "controls_has_controls_mtm_multiple" ;
382 |
383 | CREATE TABLE IF NOT EXISTS "controls_has_controls_mtm_multiple" (
384 | "controls_id" INT NOT NULL,
385 | "controls_mtm_multiple_id" INT NOT NULL,
386 | PRIMARY KEY ("controls_id", "controls_mtm_multiple_id"),
387 | CONSTRAINT "controls_id"
388 | FOREIGN KEY ("controls_id")
389 | REFERENCES "controls" ("id")
390 | ON DELETE NO ACTION
391 | ON UPDATE NO ACTION,
392 | CONSTRAINT "controls_mtm_multiple_id"
393 | FOREIGN KEY ("controls_mtm_multiple_id")
394 | REFERENCES "controls_mtm_multiple" ("id")
395 | ON DELETE NO ACTION
396 | ON UPDATE NO ACTION);
397 |
398 |
399 | -- -----------------------------------------------------
400 | -- Table "controls_inline_otm_single"
401 | -- -----------------------------------------------------
402 | DROP TABLE IF EXISTS "controls_inline_otm_single" ;
403 | CREATE SEQUENCE controls_inline_otm_single_id_seq;
404 |
405 | CREATE TABLE IF NOT EXISTS "controls_inline_otm_single" (
406 | "id" INT NOT NULL DEFAULT nextval('controls_inline_otm_single_id_seq'),
407 | "name" VARCHAR(45) NOT NULL,
408 | PRIMARY KEY ("id"));
409 |
410 |
411 | -- -----------------------------------------------------
412 | -- Table "controls_inline_otm_multiple"
413 | -- -----------------------------------------------------
414 | DROP TABLE IF EXISTS "controls_inline_otm_multiple" ;
415 | CREATE SEQUENCE controls_inline_otm_multiple_id_seq;
416 |
417 | CREATE TABLE IF NOT EXISTS "controls_inline_otm_multiple" (
418 | "id" INT NOT NULL DEFAULT nextval('controls_inline_otm_multiple_id_seq'),
419 | "first" VARCHAR(45) NOT NULL,
420 | "last" VARCHAR(45) NULL,
421 | PRIMARY KEY ("id"));
422 |
423 |
424 | -- -----------------------------------------------------
425 | -- Table "controls_inline"
426 | -- -----------------------------------------------------
427 | DROP TABLE IF EXISTS "controls_inline" ;
428 | CREATE SEQUENCE controls_inline_id_seq;
429 |
430 | CREATE TABLE IF NOT EXISTS "controls_inline" (
431 | "id" INT NOT NULL DEFAULT nextval('controls_inline_id_seq'),
432 | "controls_id" INT NOT NULL,
433 | "controls_inline_otm_single_id" INT NOT NULL,
434 | "controls_inline_otm_multiple_id" INT NOT NULL,
435 | "static" VARCHAR(45) NOT NULL,
436 | "text" VARCHAR(45) NOT NULL,
437 | "boolean" BOOLEAN NOT NULL,
438 | "bigint" BIGINT NOT NULL,
439 | "double" DOUBLE PRECISION NOT NULL,
440 | "upload" VARCHAR(45) NOT NULL,
441 | "binary" BYTEA NOT NULL,
442 | "date" DATE NOT NULL,
443 | "time" TIME NOT NULL,
444 | "datetime" TIMESTAMP NOT NULL,
445 | "textarea" TEXT NOT NULL,
446 | PRIMARY KEY ("id"),
447 | CONSTRAINT "controls_inline_otm_single_id"
448 | FOREIGN KEY ("controls_inline_otm_single_id")
449 | REFERENCES "controls_inline_otm_single" ("id")
450 | ON DELETE NO ACTION
451 | ON UPDATE NO ACTION,
452 | CONSTRAINT "controls_inline_otm_multiple_id"
453 | FOREIGN KEY ("controls_inline_otm_multiple_id")
454 | REFERENCES "controls_inline_otm_multiple" ("id")
455 | ON DELETE NO ACTION
456 | ON UPDATE NO ACTION,
457 | CONSTRAINT "controls_id"
458 | FOREIGN KEY ("controls_id")
459 | REFERENCES "controls" ("id")
460 | ON DELETE NO ACTION
461 | ON UPDATE NO ACTION);
462 |
463 |
464 | -- -----------------------------------------------------
465 | -- Table "controls_inline_mtm_single"
466 | -- -----------------------------------------------------
467 | DROP TABLE IF EXISTS "controls_inline_mtm_single" ;
468 | CREATE SEQUENCE controls_inline_mtm_single_id_seq;
469 |
470 | CREATE TABLE IF NOT EXISTS "controls_inline_mtm_single" (
471 | "id" INT NOT NULL DEFAULT nextval('controls_inline_mtm_single_id_seq'),
472 | "name" VARCHAR(45) NOT NULL,
473 | PRIMARY KEY ("id"));
474 |
475 |
476 | -- -----------------------------------------------------
477 | -- Table "controls_inline_mtm_multiple"
478 | -- -----------------------------------------------------
479 | DROP TABLE IF EXISTS "controls_inline_mtm_multiple" ;
480 | CREATE SEQUENCE controls_inline_mtm_multiple_id_seq;
481 |
482 | CREATE TABLE IF NOT EXISTS "controls_inline_mtm_multiple" (
483 | "id" INT NOT NULL DEFAULT nextval('controls_inline_mtm_multiple_id_seq'),
484 | "first" VARCHAR(45) NOT NULL,
485 | "last" VARCHAR(45) NULL,
486 | PRIMARY KEY ("id"));
487 |
488 |
489 | -- -----------------------------------------------------
490 | -- Table "controls_inline_has_controls_inline_mtm_single"
491 | -- -----------------------------------------------------
492 | DROP TABLE IF EXISTS "controls_inline_has_controls_inline_mtm_single" ;
493 |
494 | CREATE TABLE IF NOT EXISTS "controls_inline_has_controls_inline_mtm_single" (
495 | "controls_inline_id" INT NOT NULL,
496 | "controls_inline_mtm_single_id" INT NOT NULL,
497 | PRIMARY KEY ("controls_inline_id", "controls_inline_mtm_single_id"),
498 | CONSTRAINT "controls_inline_id"
499 | FOREIGN KEY ("controls_inline_id")
500 | REFERENCES "controls_inline" ("id")
501 | ON DELETE NO ACTION
502 | ON UPDATE NO ACTION,
503 | CONSTRAINT "controls_inline_mtm_single_id"
504 | FOREIGN KEY ("controls_inline_mtm_single_id")
505 | REFERENCES "controls_inline_mtm_single" ("id")
506 | ON DELETE NO ACTION
507 | ON UPDATE NO ACTION);
508 |
509 |
510 | -- -----------------------------------------------------
511 | -- Table "controls_inline_has_controls_inline_mtm_multiple"
512 | -- -----------------------------------------------------
513 | DROP TABLE IF EXISTS "controls_inline_has_controls_inline_mtm_multiple" ;
514 |
515 | CREATE TABLE IF NOT EXISTS "controls_inline_has_controls_inline_mtm_multiple" (
516 | "controls_inline_id" INT NOT NULL,
517 | "controls_inline_mtm_multiple_id" INT NOT NULL,
518 | PRIMARY KEY ("controls_inline_id", "controls_inline_mtm_multiple_id"),
519 | CONSTRAINT "controls_inline_id"
520 | FOREIGN KEY ("controls_inline_id")
521 | REFERENCES "controls_inline" ("id")
522 | ON DELETE NO ACTION
523 | ON UPDATE NO ACTION,
524 | CONSTRAINT "controls_inline_mtm_multiple_id"
525 | FOREIGN KEY ("controls_inline_mtm_multiple_id")
526 | REFERENCES "controls_inline_mtm_multiple" ("id")
527 | ON DELETE NO ACTION
528 | ON UPDATE NO ACTION);
529 |
--------------------------------------------------------------------------------
/fixtures/mysql/schema.sql:
--------------------------------------------------------------------------------
1 | SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
2 | SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
3 | SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
4 |
5 | DROP SCHEMA IF EXISTS `x-admin-examples` ;
6 | CREATE SCHEMA IF NOT EXISTS `x-admin-examples` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ;
7 | USE `x-admin-examples` ;
8 |
9 | -- -----------------------------------------------------
10 | -- Table `notes`
11 | -- -----------------------------------------------------
12 | DROP TABLE IF EXISTS `notes` ;
13 |
14 | CREATE TABLE IF NOT EXISTS `notes` (
15 | `id` INT NOT NULL AUTO_INCREMENT,
16 | `notes1` TEXT NULL,
17 | `notes2` TEXT NOT NULL,
18 | `notes3` TEXT NULL,
19 | `notes4` TEXT NOT NULL,
20 | PRIMARY KEY (`id`))
21 | ENGINE = InnoDB;
22 |
23 |
24 | -- -----------------------------------------------------
25 | -- Table `item`
26 | -- -----------------------------------------------------
27 | DROP TABLE IF EXISTS `item` ;
28 |
29 | CREATE TABLE IF NOT EXISTS `item` (
30 | `id` INT NOT NULL AUTO_INCREMENT,
31 | `name` VARCHAR(45) NOT NULL,
32 | `description` TEXT NULL,
33 | `image` VARCHAR(255) NULL,
34 | PRIMARY KEY (`id`))
35 | ENGINE = InnoDB;
36 |
37 |
38 | -- -----------------------------------------------------
39 | -- Table `user`
40 | -- -----------------------------------------------------
41 | DROP TABLE IF EXISTS `user` ;
42 |
43 | CREATE TABLE IF NOT EXISTS `user` (
44 | `id` INT NOT NULL AUTO_INCREMENT,
45 | `firstname` VARCHAR(45) NOT NULL,
46 | `lastname` VARCHAR(45) NULL,
47 | `created_at` DATETIME NOT NULL,
48 | `updated_at` DATETIME NOT NULL,
49 | PRIMARY KEY (`id`))
50 | ENGINE = InnoDB;
51 |
52 |
53 | -- -----------------------------------------------------
54 | -- Table `purchase`
55 | -- -----------------------------------------------------
56 | DROP TABLE IF EXISTS `purchase` ;
57 |
58 | CREATE TABLE IF NOT EXISTS `purchase` (
59 | `id` INT NOT NULL AUTO_INCREMENT,
60 | `item_id` INT NOT NULL,
61 | `user_id` INT NULL,
62 | `cache` DECIMAL(6,2) NOT NULL,
63 | `date` DATE NULL,
64 | `deleted` TINYINT(1) NULL,
65 | `deleted_at` DATETIME NULL,
66 | PRIMARY KEY (`id`),
67 | INDEX `fk_purchase_item_idx` (`item_id` ASC),
68 | INDEX `fk_purchase_user1_idx` (`user_id` ASC),
69 | CONSTRAINT `fk_purchase_item`
70 | FOREIGN KEY (`item_id`)
71 | REFERENCES `item` (`id`)
72 | ON DELETE NO ACTION
73 | ON UPDATE NO ACTION,
74 | CONSTRAINT `fk_purchase_user1`
75 | FOREIGN KEY (`user_id`)
76 | REFERENCES `user` (`id`)
77 | ON DELETE NO ACTION
78 | ON UPDATE NO ACTION)
79 | ENGINE = InnoDB;
80 |
81 |
82 | -- -----------------------------------------------------
83 | -- Table `recipe`
84 | -- -----------------------------------------------------
85 | DROP TABLE IF EXISTS `recipe` ;
86 |
87 | CREATE TABLE IF NOT EXISTS `recipe` (
88 | `id` INT NOT NULL AUTO_INCREMENT,
89 | `name` VARCHAR(45) NOT NULL,
90 | PRIMARY KEY (`id`))
91 | ENGINE = InnoDB;
92 |
93 |
94 | -- -----------------------------------------------------
95 | -- Table `recipe_type`
96 | -- -----------------------------------------------------
97 | DROP TABLE IF EXISTS `recipe_type` ;
98 |
99 | CREATE TABLE IF NOT EXISTS `recipe_type` (
100 | `id` INT NOT NULL AUTO_INCREMENT,
101 | `title` VARCHAR(45) NOT NULL,
102 | PRIMARY KEY (`id`))
103 | ENGINE = InnoDB;
104 |
105 |
106 | -- -----------------------------------------------------
107 | -- Table `recipe_method`
108 | -- -----------------------------------------------------
109 | DROP TABLE IF EXISTS `recipe_method` ;
110 |
111 | CREATE TABLE IF NOT EXISTS `recipe_method` (
112 | `id` INT NOT NULL AUTO_INCREMENT,
113 | `title` VARCHAR(45) NOT NULL,
114 | PRIMARY KEY (`id`))
115 | ENGINE = InnoDB;
116 |
117 |
118 | -- -----------------------------------------------------
119 | -- Table `recipe_has_recipe_types`
120 | -- -----------------------------------------------------
121 | DROP TABLE IF EXISTS `recipe_has_recipe_types` ;
122 |
123 | CREATE TABLE IF NOT EXISTS `recipe_has_recipe_types` (
124 | `recipe_id` INT NOT NULL,
125 | `recipe_type_id` INT NOT NULL,
126 | PRIMARY KEY (`recipe_id`, `recipe_type_id`),
127 | INDEX `fk_recipe_has_recipe_type_recipe_type1_idx` (`recipe_type_id` ASC),
128 | INDEX `fk_recipe_has_recipe_type_recipe1_idx` (`recipe_id` ASC),
129 | CONSTRAINT `fk_recipe_has_recipe_type_recipe1`
130 | FOREIGN KEY (`recipe_id`)
131 | REFERENCES `recipe` (`id`)
132 | ON DELETE NO ACTION
133 | ON UPDATE NO ACTION,
134 | CONSTRAINT `fk_recipe_has_recipe_type_recipe_type1`
135 | FOREIGN KEY (`recipe_type_id`)
136 | REFERENCES `recipe_type` (`id`)
137 | ON DELETE NO ACTION
138 | ON UPDATE NO ACTION)
139 | ENGINE = InnoDB;
140 |
141 |
142 | -- -----------------------------------------------------
143 | -- Table `recipe_has_recipe_methods`
144 | -- -----------------------------------------------------
145 | DROP TABLE IF EXISTS `recipe_has_recipe_methods` ;
146 |
147 | CREATE TABLE IF NOT EXISTS `recipe_has_recipe_methods` (
148 | `recipe_id` INT NOT NULL,
149 | `recipe_method_id` INT NOT NULL,
150 | PRIMARY KEY (`recipe_id`, `recipe_method_id`),
151 | INDEX `fk_recipe_has_recipe_methods_recipe_method1_idx` (`recipe_method_id` ASC),
152 | INDEX `fk_recipe_has_recipe_methods_recipe1_idx` (`recipe_id` ASC),
153 | CONSTRAINT `fk_recipe_has_recipe_methods_recipe1`
154 | FOREIGN KEY (`recipe_id`)
155 | REFERENCES `recipe` (`id`)
156 | ON DELETE NO ACTION
157 | ON UPDATE NO ACTION,
158 | CONSTRAINT `fk_recipe_has_recipe_methods_recipe_method1`
159 | FOREIGN KEY (`recipe_method_id`)
160 | REFERENCES `recipe_method` (`id`)
161 | ON DELETE NO ACTION
162 | ON UPDATE NO ACTION)
163 | ENGINE = InnoDB;
164 |
165 |
166 | -- -----------------------------------------------------
167 | -- Table `address`
168 | -- -----------------------------------------------------
169 | DROP TABLE IF EXISTS `address` ;
170 |
171 | CREATE TABLE IF NOT EXISTS `address` (
172 | `id` INT NOT NULL AUTO_INCREMENT,
173 | `user_id` INT NOT NULL,
174 | `street` VARCHAR(45) NOT NULL,
175 | PRIMARY KEY (`id`),
176 | INDEX `fk_address_user1_idx` (`user_id` ASC),
177 | CONSTRAINT `fk_address_user1`
178 | FOREIGN KEY (`user_id`)
179 | REFERENCES `user` (`id`)
180 | ON DELETE NO ACTION
181 | ON UPDATE NO ACTION)
182 | ENGINE = InnoDB;
183 |
184 |
185 | -- -----------------------------------------------------
186 | -- Table `phone`
187 | -- -----------------------------------------------------
188 | DROP TABLE IF EXISTS `phone` ;
189 |
190 | CREATE TABLE IF NOT EXISTS `phone` (
191 | `id` INT NOT NULL AUTO_INCREMENT,
192 | `user_id` INT NOT NULL,
193 | `mobile` VARCHAR(45) NOT NULL,
194 | PRIMARY KEY (`id`),
195 | INDEX `fk_phone_user1_idx` (`user_id` ASC),
196 | CONSTRAINT `fk_phone_user1`
197 | FOREIGN KEY (`user_id`)
198 | REFERENCES `user` (`id`)
199 | ON DELETE NO ACTION
200 | ON UPDATE NO ACTION)
201 | ENGINE = InnoDB;
202 |
203 |
204 | -- -----------------------------------------------------
205 | -- Table `car`
206 | -- -----------------------------------------------------
207 | DROP TABLE IF EXISTS `car` ;
208 |
209 | CREATE TABLE IF NOT EXISTS `car` (
210 | `id` INT NOT NULL AUTO_INCREMENT,
211 | `model` VARCHAR(45) NOT NULL,
212 | PRIMARY KEY (`id`))
213 | ENGINE = InnoDB;
214 |
215 |
216 | -- -----------------------------------------------------
217 | -- Table `repair`
218 | -- -----------------------------------------------------
219 | DROP TABLE IF EXISTS `repair` ;
220 |
221 | CREATE TABLE IF NOT EXISTS `repair` (
222 | `id` INT NOT NULL AUTO_INCREMENT,
223 | `car_id` INT NOT NULL,
224 | `date` DATE NOT NULL,
225 | PRIMARY KEY (`id`),
226 | INDEX `fk_repair_car1_idx` (`car_id` ASC),
227 | CONSTRAINT `fk_repair_car1`
228 | FOREIGN KEY (`car_id`)
229 | REFERENCES `car` (`id`)
230 | ON DELETE NO ACTION
231 | ON UPDATE NO ACTION)
232 | ENGINE = InnoDB;
233 |
234 |
235 | -- -----------------------------------------------------
236 | -- Table `driver`
237 | -- -----------------------------------------------------
238 | DROP TABLE IF EXISTS `driver` ;
239 |
240 | CREATE TABLE IF NOT EXISTS `driver` (
241 | `id` INT NOT NULL AUTO_INCREMENT,
242 | `car_id` INT NOT NULL,
243 | `name` VARCHAR(45) NOT NULL,
244 | PRIMARY KEY (`id`),
245 | INDEX `fk_driver_car1_idx` (`car_id` ASC),
246 | CONSTRAINT `fk_driver_car1`
247 | FOREIGN KEY (`car_id`)
248 | REFERENCES `car` (`id`)
249 | ON DELETE NO ACTION
250 | ON UPDATE NO ACTION)
251 | ENGINE = InnoDB;
252 |
253 |
254 | -- -----------------------------------------------------
255 | -- Table `controls_otm_single`
256 | -- -----------------------------------------------------
257 | DROP TABLE IF EXISTS `controls_otm_single` ;
258 |
259 | CREATE TABLE IF NOT EXISTS `controls_otm_single` (
260 | `id` INT NOT NULL AUTO_INCREMENT,
261 | `name` VARCHAR(45) NOT NULL,
262 | PRIMARY KEY (`id`))
263 | ENGINE = InnoDB;
264 |
265 |
266 | -- -----------------------------------------------------
267 | -- Table `controls_otm_multiple`
268 | -- -----------------------------------------------------
269 | DROP TABLE IF EXISTS `controls_otm_multiple` ;
270 |
271 | CREATE TABLE IF NOT EXISTS `controls_otm_multiple` (
272 | `id` INT NOT NULL AUTO_INCREMENT,
273 | `first` VARCHAR(45) NOT NULL,
274 | `last` VARCHAR(45) NULL,
275 | PRIMARY KEY (`id`))
276 | ENGINE = InnoDB;
277 |
278 |
279 | -- -----------------------------------------------------
280 | -- Table `controls`
281 | -- -----------------------------------------------------
282 | DROP TABLE IF EXISTS `controls` ;
283 |
284 | CREATE TABLE IF NOT EXISTS `controls` (
285 | `id` INT NOT NULL AUTO_INCREMENT,
286 | `controls_otm_single_id` INT NULL,
287 | `controls_otm_multiple_id` INT NULL,
288 | `static` VARCHAR(45) NULL,
289 | `text` VARCHAR(45) NULL,
290 | `boolean` TINYINT(1) NULL,
291 | `bigint` BIGINT NULL,
292 | `double` DOUBLE NULL,
293 | `upload` VARCHAR(45) NULL,
294 | `binary` BLOB NULL,
295 | `date` DATE NULL,
296 | `time` TIME NULL,
297 | `datetime` DATETIME NULL,
298 | `year` YEAR NULL,
299 | `textarea` TEXT NULL,
300 | PRIMARY KEY (`id`),
301 | INDEX `fk_controls_controls_otm_single1_idx` (`controls_otm_single_id` ASC),
302 | INDEX `fk_controls_controls_otm_multiple1_idx` (`controls_otm_multiple_id` ASC),
303 | CONSTRAINT `fk_controls_controls_otm_single1`
304 | FOREIGN KEY (`controls_otm_single_id`)
305 | REFERENCES `controls_otm_single` (`id`)
306 | ON DELETE NO ACTION
307 | ON UPDATE NO ACTION,
308 | CONSTRAINT `fk_controls_controls_otm_multiple1`
309 | FOREIGN KEY (`controls_otm_multiple_id`)
310 | REFERENCES `controls_otm_multiple` (`id`)
311 | ON DELETE NO ACTION
312 | ON UPDATE NO ACTION)
313 | ENGINE = InnoDB;
314 |
315 |
316 | -- -----------------------------------------------------
317 | -- Table `controls_mtm_single`
318 | -- -----------------------------------------------------
319 | DROP TABLE IF EXISTS `controls_mtm_single` ;
320 |
321 | CREATE TABLE IF NOT EXISTS `controls_mtm_single` (
322 | `id` INT NOT NULL AUTO_INCREMENT,
323 | `name` VARCHAR(45) NOT NULL,
324 | PRIMARY KEY (`id`))
325 | ENGINE = InnoDB;
326 |
327 |
328 | -- -----------------------------------------------------
329 | -- Table `controls_mtm_multiple`
330 | -- -----------------------------------------------------
331 | DROP TABLE IF EXISTS `controls_mtm_multiple` ;
332 |
333 | CREATE TABLE IF NOT EXISTS `controls_mtm_multiple` (
334 | `id` INT NOT NULL AUTO_INCREMENT,
335 | `first` VARCHAR(45) NOT NULL,
336 | `last` VARCHAR(45) NULL,
337 | PRIMARY KEY (`id`))
338 | ENGINE = InnoDB;
339 |
340 |
341 | -- -----------------------------------------------------
342 | -- Table `controls_has_controls_mtm_single`
343 | -- -----------------------------------------------------
344 | DROP TABLE IF EXISTS `controls_has_controls_mtm_single` ;
345 |
346 | CREATE TABLE IF NOT EXISTS `controls_has_controls_mtm_single` (
347 | `controls_id` INT NOT NULL,
348 | `controls_mtm_single_id` INT NOT NULL,
349 | PRIMARY KEY (`controls_id`, `controls_mtm_single_id`),
350 | INDEX `fk_controls_has_controls_mtm_single_controls_mtm_single1_idx` (`controls_mtm_single_id` ASC),
351 | INDEX `fk_controls_has_controls_mtm_single_controls1_idx` (`controls_id` ASC),
352 | CONSTRAINT `fk_controls_has_controls_mtm_single_controls1`
353 | FOREIGN KEY (`controls_id`)
354 | REFERENCES `controls` (`id`)
355 | ON DELETE NO ACTION
356 | ON UPDATE NO ACTION,
357 | CONSTRAINT `fk_controls_has_controls_mtm_single_controls_mtm_single1`
358 | FOREIGN KEY (`controls_mtm_single_id`)
359 | REFERENCES `controls_mtm_single` (`id`)
360 | ON DELETE NO ACTION
361 | ON UPDATE NO ACTION)
362 | ENGINE = InnoDB;
363 |
364 |
365 | -- -----------------------------------------------------
366 | -- Table `controls_has_controls_mtm_multiple`
367 | -- -----------------------------------------------------
368 | DROP TABLE IF EXISTS `controls_has_controls_mtm_multiple` ;
369 |
370 | CREATE TABLE IF NOT EXISTS `controls_has_controls_mtm_multiple` (
371 | `controls_id` INT NOT NULL,
372 | `controls_mtm_multiple_id` INT NOT NULL,
373 | PRIMARY KEY (`controls_id`, `controls_mtm_multiple_id`),
374 | INDEX `fk_controls_has_controls_mtm_multiple_controls_mtm_multiple_idx` (`controls_mtm_multiple_id` ASC),
375 | INDEX `fk_controls_has_controls_mtm_multiple_controls1_idx` (`controls_id` ASC),
376 | CONSTRAINT `fk_controls_has_controls_mtm_multiple_controls1`
377 | FOREIGN KEY (`controls_id`)
378 | REFERENCES `controls` (`id`)
379 | ON DELETE NO ACTION
380 | ON UPDATE NO ACTION,
381 | CONSTRAINT `fk_controls_has_controls_mtm_multiple_controls_mtm_multiple1`
382 | FOREIGN KEY (`controls_mtm_multiple_id`)
383 | REFERENCES `controls_mtm_multiple` (`id`)
384 | ON DELETE NO ACTION
385 | ON UPDATE NO ACTION)
386 | ENGINE = InnoDB;
387 |
388 |
389 | -- -----------------------------------------------------
390 | -- Table `controls_inline_otm_single`
391 | -- -----------------------------------------------------
392 | DROP TABLE IF EXISTS `controls_inline_otm_single` ;
393 |
394 | CREATE TABLE IF NOT EXISTS `controls_inline_otm_single` (
395 | `id` INT NOT NULL AUTO_INCREMENT,
396 | `name` VARCHAR(45) NOT NULL,
397 | PRIMARY KEY (`id`))
398 | ENGINE = InnoDB;
399 |
400 |
401 | -- -----------------------------------------------------
402 | -- Table `controls_inline_otm_multiple`
403 | -- -----------------------------------------------------
404 | DROP TABLE IF EXISTS `controls_inline_otm_multiple` ;
405 |
406 | CREATE TABLE IF NOT EXISTS `controls_inline_otm_multiple` (
407 | `id` INT NOT NULL AUTO_INCREMENT,
408 | `first` VARCHAR(45) NOT NULL,
409 | `last` VARCHAR(45) NULL,
410 | PRIMARY KEY (`id`))
411 | ENGINE = InnoDB;
412 |
413 |
414 | -- -----------------------------------------------------
415 | -- Table `controls_inline`
416 | -- -----------------------------------------------------
417 | DROP TABLE IF EXISTS `controls_inline` ;
418 |
419 | CREATE TABLE IF NOT EXISTS `controls_inline` (
420 | `id` INT NOT NULL AUTO_INCREMENT,
421 | `controls_id` INT NOT NULL,
422 | `controls_inline_otm_single_id` INT NOT NULL,
423 | `controls_inline_otm_multiple_id` INT NOT NULL,
424 | `static` VARCHAR(45) NOT NULL,
425 | `text` VARCHAR(45) NOT NULL,
426 | `boolean` TINYINT(1) NOT NULL,
427 | `bigint` BIGINT NOT NULL,
428 | `double` DOUBLE NOT NULL,
429 | `upload` VARCHAR(45) NOT NULL,
430 | `binary` BLOB NOT NULL,
431 | `date` DATE NOT NULL,
432 | `time` TIME NOT NULL,
433 | `datetime` DATETIME NOT NULL,
434 | `year` YEAR NOT NULL,
435 | `textarea` TEXT NOT NULL,
436 | PRIMARY KEY (`id`),
437 | INDEX `fk_controls_inline_controls_inline_otm_single1_idx` (`controls_inline_otm_single_id` ASC),
438 | INDEX `fk_controls_inline_controls_inline_otm_multiple1_idx` (`controls_inline_otm_multiple_id` ASC),
439 | INDEX `fk_controls_inline_controls1_idx` (`controls_id` ASC),
440 | CONSTRAINT `fk_controls_inline_controls_inline_otm_single1`
441 | FOREIGN KEY (`controls_inline_otm_single_id`)
442 | REFERENCES `controls_inline_otm_single` (`id`)
443 | ON DELETE NO ACTION
444 | ON UPDATE NO ACTION,
445 | CONSTRAINT `fk_controls_inline_controls_inline_otm_multiple1`
446 | FOREIGN KEY (`controls_inline_otm_multiple_id`)
447 | REFERENCES `controls_inline_otm_multiple` (`id`)
448 | ON DELETE NO ACTION
449 | ON UPDATE NO ACTION,
450 | CONSTRAINT `fk_controls_inline_controls1`
451 | FOREIGN KEY (`controls_id`)
452 | REFERENCES `controls` (`id`)
453 | ON DELETE NO ACTION
454 | ON UPDATE NO ACTION)
455 | ENGINE = InnoDB;
456 |
457 |
458 | -- -----------------------------------------------------
459 | -- Table `controls_inline_mtm_single`
460 | -- -----------------------------------------------------
461 | DROP TABLE IF EXISTS `controls_inline_mtm_single` ;
462 |
463 | CREATE TABLE IF NOT EXISTS `controls_inline_mtm_single` (
464 | `id` INT NOT NULL AUTO_INCREMENT,
465 | `name` VARCHAR(45) NOT NULL,
466 | PRIMARY KEY (`id`))
467 | ENGINE = InnoDB;
468 |
469 |
470 | -- -----------------------------------------------------
471 | -- Table `controls_inline_mtm_multiple`
472 | -- -----------------------------------------------------
473 | DROP TABLE IF EXISTS `controls_inline_mtm_multiple` ;
474 |
475 | CREATE TABLE IF NOT EXISTS `controls_inline_mtm_multiple` (
476 | `id` INT NOT NULL AUTO_INCREMENT,
477 | `first` VARCHAR(45) NOT NULL,
478 | `last` VARCHAR(45) NULL,
479 | PRIMARY KEY (`id`))
480 | ENGINE = InnoDB;
481 |
482 |
483 | -- -----------------------------------------------------
484 | -- Table `controls_inline_has_controls_inline_mtm_single`
485 | -- -----------------------------------------------------
486 | DROP TABLE IF EXISTS `controls_inline_has_controls_inline_mtm_single` ;
487 |
488 | CREATE TABLE IF NOT EXISTS `controls_inline_has_controls_inline_mtm_single` (
489 | `controls_inline_id` INT NOT NULL,
490 | `controls_inline_mtm_single_id` INT NOT NULL,
491 | PRIMARY KEY (`controls_inline_id`, `controls_inline_mtm_single_id`),
492 | INDEX `fk_controls_inline_has_controls_inline_mtm_single_controls__idx` (`controls_inline_mtm_single_id` ASC),
493 | INDEX `fk_controls_inline_has_controls_inline_mtm_single_controls__idx1` (`controls_inline_id` ASC),
494 | CONSTRAINT `fk_controls_inline_has_controls_inline_mtm_single_controls_in1`
495 | FOREIGN KEY (`controls_inline_id`)
496 | REFERENCES `controls_inline` (`id`)
497 | ON DELETE NO ACTION
498 | ON UPDATE NO ACTION,
499 | CONSTRAINT `fk_controls_inline_has_controls_inline_mtm_single_controls_in2`
500 | FOREIGN KEY (`controls_inline_mtm_single_id`)
501 | REFERENCES `controls_inline_mtm_single` (`id`)
502 | ON DELETE NO ACTION
503 | ON UPDATE NO ACTION)
504 | ENGINE = InnoDB;
505 |
506 |
507 | -- -----------------------------------------------------
508 | -- Table `controls_inline_has_controls_inline_mtm_multiple`
509 | -- -----------------------------------------------------
510 | DROP TABLE IF EXISTS `controls_inline_has_controls_inline_mtm_multiple` ;
511 |
512 | CREATE TABLE IF NOT EXISTS `controls_inline_has_controls_inline_mtm_multiple` (
513 | `controls_inline_id` INT NOT NULL,
514 | `controls_inline_mtm_multiple_id` INT NOT NULL,
515 | PRIMARY KEY (`controls_inline_id`, `controls_inline_mtm_multiple_id`),
516 | INDEX `fk_controls_inline_has_controls_inline_mtm_multiple_control_idx` (`controls_inline_mtm_multiple_id` ASC),
517 | INDEX `fk_controls_inline_has_controls_inline_mtm_multiple_control_idx1` (`controls_inline_id` ASC),
518 | CONSTRAINT `fk_controls_inline_has_controls_inline_mtm_multiple_controls_1`
519 | FOREIGN KEY (`controls_inline_id`)
520 | REFERENCES `controls_inline` (`id`)
521 | ON DELETE NO ACTION
522 | ON UPDATE NO ACTION,
523 | CONSTRAINT `fk_controls_inline_has_controls_inline_mtm_multiple_controls_2`
524 | FOREIGN KEY (`controls_inline_mtm_multiple_id`)
525 | REFERENCES `controls_inline_mtm_multiple` (`id`)
526 | ON DELETE NO ACTION
527 | ON UPDATE NO ACTION)
528 | ENGINE = InnoDB;
529 |
530 |
531 | SET SQL_MODE=@OLD_SQL_MODE;
532 | SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
533 | SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
534 |
--------------------------------------------------------------------------------
/config/pg/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "purchase": {
3 | "slug": "purchase",
4 | "table": {
5 | "name": "purchase",
6 | "pk": "id",
7 | "verbose": "Purchase (One to Many)"
8 | },
9 | "columns": [
10 | {
11 | "verbose": "id",
12 | "name": "id",
13 | "control": {
14 | "text": true
15 | },
16 | "type": "int(11)",
17 | "allowNull": false,
18 | "defaultValue": null,
19 | "listview": {
20 | "show": false
21 | },
22 | "editview": {
23 | "show": false
24 | }
25 | },
26 | {
27 | "verbose": "Item",
28 | "name": "item_id",
29 | "control": {
30 | "select": true
31 | },
32 | "type": "int(11)",
33 | "allowNull": false,
34 | "defaultValue": null,
35 | "listview": {
36 | "show": true
37 | },
38 | "editview": {
39 | "show": true
40 | },
41 | "oneToMany": {
42 | "table": "item",
43 | "pk": "id",
44 | "columns": [
45 | "name"
46 | ]
47 | }
48 | },
49 | {
50 | "verbose": "User",
51 | "name": "user_id",
52 | "control": {
53 | "select": true
54 | },
55 | "type": "int(11)",
56 | "allowNull": true,
57 | "defaultValue": null,
58 | "listview": {
59 | "show": true
60 | },
61 | "editview": {
62 | "show": true
63 | },
64 | "oneToMany": {
65 | "table": "user",
66 | "pk": "id",
67 | "columns": [
68 | "firstname",
69 | "lastname"
70 | ]
71 | }
72 | },
73 | {
74 | "verbose": "Cache",
75 | "name": "cache",
76 | "control": {
77 | "text": true
78 | },
79 | "type": "decimal(6,2)",
80 | "allowNull": false,
81 | "defaultValue": null,
82 | "listview": {
83 | "show": true
84 | },
85 | "editview": {
86 | "show": true
87 | }
88 | },
89 | {
90 | "verbose": "Date",
91 | "name": "date",
92 | "control": {
93 | "date": true
94 | },
95 | "type": "date",
96 | "allowNull": true,
97 | "defaultValue": null,
98 | "listview": {
99 | "show": true
100 | },
101 | "editview": {
102 | "show": true
103 | }
104 | },
105 | {
106 | "name": "deleted",
107 | "verbose": "Deleted",
108 | "control": {
109 | "radio": true,
110 | "options": [
111 | "Yes",
112 | "No"
113 | ]
114 | },
115 | "type": "boolean",
116 | "allowNull": true,
117 | "defaultValue": null,
118 | "listview": {
119 | "show": false
120 | },
121 | "editview": {
122 | "show": false
123 | }
124 | },
125 | {
126 | "name": "deleted_at",
127 | "verbose": "Deleted At",
128 | "control": {
129 | "datetime": true
130 | },
131 | "type": "datetime",
132 | "allowNull": true,
133 | "defaultValue": null,
134 | "listview": {
135 | "show": false
136 | },
137 | "editview": {
138 | "show": false
139 | }
140 | }
141 | ],
142 | "mainview": {
143 | "show": true
144 | },
145 | "listview": {
146 | "order": {},
147 | "page": 5,
148 | "filter": [
149 | "item_id",
150 | "user_id",
151 | "cache",
152 | "date",
153 | "deleted",
154 | "deleted_at"
155 | ]
156 | },
157 | "editview": {
158 | "readonly": false
159 | }
160 | },
161 | "item": {
162 | "slug": "item",
163 | "table": {
164 | "name": "item",
165 | "pk": "id",
166 | "verbose": "Item"
167 | },
168 | "columns": [
169 | {
170 | "verbose": "id",
171 | "name": "id",
172 | "control": {
173 | "text": true
174 | },
175 | "type": "int(11)",
176 | "allowNull": false,
177 | "defaultValue": null,
178 | "listview": {
179 | "show": false
180 | },
181 | "editview": {
182 | "show": false
183 | }
184 | },
185 | {
186 | "verbose": "name",
187 | "name": "name",
188 | "control": {
189 | "text": true
190 | },
191 | "type": "varchar(45)",
192 | "allowNull": false,
193 | "defaultValue": null,
194 | "listview": {
195 | "show": true
196 | },
197 | "editview": {
198 | "show": true
199 | }
200 | },
201 | {
202 | "verbose": "description",
203 | "name": "description",
204 | "control": {
205 | "textarea": true
206 | },
207 | "type": "text",
208 | "allowNull": true,
209 | "defaultValue": null,
210 | "listview": {
211 | "show": false
212 | },
213 | "editview": {
214 | "show": true
215 | }
216 | },
217 | {
218 | "name": "image",
219 | "verbose": "image",
220 | "control": {
221 | "file": true
222 | },
223 | "type": "varchar(255)",
224 | "allowNull": true,
225 | "defaultValue": null,
226 | "listview": {
227 | "show": true
228 | },
229 | "editview": {
230 | "show": true
231 | }
232 | }
233 | ],
234 | "mainview": {
235 | "show": true
236 | },
237 | "listview": {
238 | "order": {},
239 | "page": 25
240 | },
241 | "editview": {
242 | "readonly": false
243 | }
244 | },
245 | "recipe": {
246 | "slug": "recipe",
247 | "table": {
248 | "name": "recipe",
249 | "pk": "id",
250 | "verbose": "Recipe (Many to Many)"
251 | },
252 | "columns": [
253 | {
254 | "verbose": "id",
255 | "name": "id",
256 | "control": {
257 | "text": true
258 | },
259 | "type": "int(11)",
260 | "allowNull": false,
261 | "defaultValue": null,
262 | "listview": {
263 | "show": true
264 | },
265 | "editview": {
266 | "show": false
267 | }
268 | },
269 | {
270 | "verbose": "Name",
271 | "name": "name",
272 | "control": {
273 | "text": true
274 | },
275 | "type": "varchar(45)",
276 | "allowNull": false,
277 | "defaultValue": null,
278 | "listview": {
279 | "show": true
280 | },
281 | "editview": {
282 | "show": true
283 | }
284 | },
285 | {
286 | "verbose": "Recipe Types",
287 | "name": "recipe_type",
288 | "control": {
289 | "select": true,
290 | "multiple": true
291 | },
292 | "type": "int(11)",
293 | "allowNull": false,
294 | "listview": {
295 | "show": false
296 | },
297 | "editview": {
298 | "show": true
299 | },
300 | "manyToMany": {
301 | "link": {
302 | "table": "recipe_has_recipe_types",
303 | "parentPk": "recipe_id",
304 | "childPk": "recipe_type_id"
305 | },
306 | "ref": {
307 | "table": "recipe_type",
308 | "pk": "id",
309 | "columns": [
310 | "title"
311 | ]
312 | }
313 | }
314 | },
315 | {
316 | "verbose": "Recipe Methods",
317 | "name": "recipe_method",
318 | "control": {
319 | "select": true,
320 | "multiple": true
321 | },
322 | "type": "int(11)",
323 | "allowNull": true,
324 | "listview": {
325 | "show": false
326 | },
327 | "editview": {
328 | "show": true
329 | },
330 | "manyToMany": {
331 | "link": {
332 | "table": "recipe_has_recipe_methods",
333 | "parentPk": "recipe_id",
334 | "childPk": "recipe_method_id"
335 | },
336 | "ref": {
337 | "table": "recipe_method",
338 | "pk": "id",
339 | "columns": [
340 | "title"
341 | ]
342 | }
343 | }
344 | }
345 | ],
346 | "mainview": {
347 | "show": true
348 | },
349 | "listview": {
350 | "order": {},
351 | "page": 25
352 | },
353 | "editview": {
354 | "readonly": false
355 | }
356 | },
357 | "recipe_has_recipe_methods": {
358 | "slug": "recipe_has_recipe_methods",
359 | "table": {
360 | "name": "recipe_has_recipe_methods",
361 | "pk": "recipe_id",
362 | "verbose": "recipe_has_recipe_methods"
363 | },
364 | "columns": [
365 | {
366 | "verbose": "recipe_id",
367 | "name": "recipe_id",
368 | "control": {
369 | "text": true
370 | },
371 | "type": "int(11)",
372 | "allowNull": false,
373 | "defaultValue": null,
374 | "listview": {
375 | "show": true
376 | },
377 | "editview": {
378 | "show": true
379 | }
380 | },
381 | {
382 | "verbose": "recipe_method_id",
383 | "name": "recipe_method_id",
384 | "control": {
385 | "text": true
386 | },
387 | "type": "int(11)",
388 | "allowNull": false,
389 | "defaultValue": null,
390 | "listview": {
391 | "show": true
392 | },
393 | "editview": {
394 | "show": true
395 | }
396 | }
397 | ],
398 | "mainview": {
399 | "show": false
400 | },
401 | "listview": {
402 | "order": {},
403 | "page": 25
404 | },
405 | "editview": {
406 | "readonly": false
407 | }
408 | },
409 | "recipe_has_recipe_types": {
410 | "slug": "recipe_has_recipe_types",
411 | "table": {
412 | "name": "recipe_has_recipe_types",
413 | "pk": "recipe_id",
414 | "verbose": "recipe_has_recipe_types"
415 | },
416 | "columns": [
417 | {
418 | "verbose": "recipe_id",
419 | "name": "recipe_id",
420 | "control": {
421 | "text": true
422 | },
423 | "type": "int(11)",
424 | "allowNull": false,
425 | "defaultValue": null,
426 | "listview": {
427 | "show": true
428 | },
429 | "editview": {
430 | "show": true
431 | }
432 | },
433 | {
434 | "verbose": "recipe_type_id",
435 | "name": "recipe_type_id",
436 | "control": {
437 | "text": true
438 | },
439 | "type": "int(11)",
440 | "allowNull": false,
441 | "defaultValue": null,
442 | "listview": {
443 | "show": true
444 | },
445 | "editview": {
446 | "show": true
447 | }
448 | }
449 | ],
450 | "mainview": {
451 | "show": false
452 | },
453 | "listview": {
454 | "order": {},
455 | "page": 25
456 | },
457 | "editview": {
458 | "readonly": false
459 | }
460 | },
461 | "recipe_method": {
462 | "slug": "recipe_method",
463 | "table": {
464 | "name": "recipe_method",
465 | "pk": "id",
466 | "verbose": "Recipe Method"
467 | },
468 | "columns": [
469 | {
470 | "verbose": "id",
471 | "name": "id",
472 | "control": {
473 | "text": true
474 | },
475 | "type": "int(11)",
476 | "allowNull": false,
477 | "defaultValue": null,
478 | "listview": {
479 | "show": false
480 | },
481 | "editview": {
482 | "show": false
483 | }
484 | },
485 | {
486 | "verbose": "title",
487 | "name": "title",
488 | "control": {
489 | "text": true
490 | },
491 | "type": "varchar(45)",
492 | "allowNull": false,
493 | "defaultValue": null,
494 | "listview": {
495 | "show": true
496 | },
497 | "editview": {
498 | "show": true
499 | }
500 | }
501 | ],
502 | "mainview": {
503 | "show": true
504 | },
505 | "listview": {
506 | "order": {},
507 | "page": 25
508 | },
509 | "editview": {
510 | "readonly": false
511 | }
512 | },
513 | "recipe_type": {
514 | "slug": "recipe_type",
515 | "table": {
516 | "name": "recipe_type",
517 | "pk": "id",
518 | "verbose": "Recipe Type"
519 | },
520 | "columns": [
521 | {
522 | "verbose": "id",
523 | "name": "id",
524 | "control": {
525 | "text": true
526 | },
527 | "type": "int(11)",
528 | "allowNull": false,
529 | "defaultValue": null,
530 | "listview": {
531 | "show": false
532 | },
533 | "editview": {
534 | "show": false
535 | }
536 | },
537 | {
538 | "verbose": "title",
539 | "name": "title",
540 | "control": {
541 | "text": true
542 | },
543 | "type": "varchar(45)",
544 | "allowNull": false,
545 | "defaultValue": null,
546 | "listview": {
547 | "show": true
548 | },
549 | "editview": {
550 | "show": true
551 | }
552 | }
553 | ],
554 | "mainview": {
555 | "show": true
556 | },
557 | "listview": {
558 | "order": {},
559 | "page": 25
560 | },
561 | "editview": {
562 | "readonly": false
563 | }
564 | },
565 | "user": {
566 | "slug": "user",
567 | "table": {
568 | "name": "user",
569 | "pk": "id",
570 | "verbose": "User (One to One)"
571 | },
572 | "columns": [
573 | {
574 | "verbose": "id",
575 | "name": "id",
576 | "control": {
577 | "text": true
578 | },
579 | "type": "int(11)",
580 | "allowNull": false,
581 | "defaultValue": null,
582 | "listview": {
583 | "show": false
584 | },
585 | "editview": {
586 | "show": false
587 | }
588 | },
589 | {
590 | "verbose": "firstname",
591 | "name": "firstname",
592 | "control": {
593 | "text": true
594 | },
595 | "type": "varchar(45)",
596 | "allowNull": false,
597 | "defaultValue": null,
598 | "listview": {
599 | "show": true
600 | },
601 | "editview": {
602 | "show": true
603 | }
604 | },
605 | {
606 | "verbose": "lastname",
607 | "name": "lastname",
608 | "control": {
609 | "text": true
610 | },
611 | "type": "varchar(45)",
612 | "allowNull": true,
613 | "defaultValue": null,
614 | "listview": {
615 | "show": true
616 | },
617 | "editview": {
618 | "show": true
619 | }
620 | },
621 | {
622 | "name": "created_at",
623 | "verbose": "created_at",
624 | "control": {
625 | "text": true
626 | },
627 | "type": "datetime",
628 | "allowNull": false,
629 | "defaultValue": null,
630 | "listview": {
631 | "show": true
632 | },
633 | "editview": {
634 | "show": false
635 | }
636 | },
637 | {
638 | "name": "updated_at",
639 | "verbose": "updated_at",
640 | "control": {
641 | "text": true
642 | },
643 | "type": "datetime",
644 | "allowNull": false,
645 | "defaultValue": null,
646 | "listview": {
647 | "show": true
648 | },
649 | "editview": {
650 | "show": false
651 | }
652 | }
653 | ],
654 | "mainview": {
655 | "show": true
656 | },
657 | "listview": {
658 | "order": {},
659 | "page": 25
660 | },
661 | "editview": {
662 | "readonly": false,
663 | "oneToOne": {
664 | "address": "user_id",
665 | "phone": "user_id"
666 | }
667 | }
668 | },
669 | "address": {
670 | "slug": "address",
671 | "table": {
672 | "name": "address",
673 | "pk": "id",
674 | "verbose": "Address"
675 | },
676 | "columns": [
677 | {
678 | "verbose": "id",
679 | "name": "id",
680 | "control": {
681 | "text": true
682 | },
683 | "type": "int(11)",
684 | "allowNull": false,
685 | "defaultValue": null,
686 | "listview": {
687 | "show": true
688 | },
689 | "editview": {
690 | "show": false
691 | }
692 | },
693 | {
694 | "verbose": "user_id",
695 | "name": "user_id",
696 | "control": {
697 | "text": true
698 | },
699 | "type": "int(11)",
700 | "allowNull": false,
701 | "defaultValue": null,
702 | "listview": {
703 | "show": true
704 | },
705 | "editview": {
706 | "show": false
707 | }
708 | },
709 | {
710 | "verbose": "street",
711 | "name": "street",
712 | "control": {
713 | "text": true
714 | },
715 | "type": "varchar(45)",
716 | "allowNull": false,
717 | "defaultValue": null,
718 | "listview": {
719 | "show": true
720 | },
721 | "editview": {
722 | "show": true
723 | }
724 | }
725 | ],
726 | "mainview": {
727 | "show": false
728 | },
729 | "listview": {
730 | "order": {},
731 | "page": 25
732 | },
733 | "editview": {
734 | "readonly": false
735 | }
736 | },
737 | "phone": {
738 | "slug": "phone",
739 | "table": {
740 | "name": "phone",
741 | "pk": "id",
742 | "verbose": "Phone"
743 | },
744 | "columns": [
745 | {
746 | "verbose": "id",
747 | "name": "id",
748 | "control": {
749 | "text": true
750 | },
751 | "type": "int(11)",
752 | "allowNull": false,
753 | "defaultValue": null,
754 | "listview": {
755 | "show": true
756 | },
757 | "editview": {
758 | "show": false
759 | }
760 | },
761 | {
762 | "verbose": "user_id",
763 | "name": "user_id",
764 | "control": {
765 | "text": true
766 | },
767 | "type": "int(11)",
768 | "allowNull": false,
769 | "defaultValue": null,
770 | "listview": {
771 | "show": true
772 | },
773 | "editview": {
774 | "show": false
775 | }
776 | },
777 | {
778 | "verbose": "mobile",
779 | "name": "mobile",
780 | "control": {
781 | "text": true
782 | },
783 | "type": "varchar(45)",
784 | "allowNull": false,
785 | "defaultValue": null,
786 | "listview": {
787 | "show": true
788 | },
789 | "editview": {
790 | "show": true
791 | }
792 | }
793 | ],
794 | "mainview": {
795 | "show": false
796 | },
797 | "listview": {
798 | "order": {},
799 | "page": 25
800 | },
801 | "editview": {
802 | "readonly": false
803 | }
804 | },
805 | "car": {
806 | "slug": "car",
807 | "table": {
808 | "name": "car",
809 | "pk": "id",
810 | "verbose": "Car (Many to One)"
811 | },
812 | "columns": [
813 | {
814 | "verbose": "id",
815 | "name": "id",
816 | "control": {
817 | "text": true
818 | },
819 | "type": "int(11)",
820 | "allowNull": false,
821 | "defaultValue": null,
822 | "listview": {
823 | "show": false
824 | },
825 | "editview": {
826 | "show": false
827 | }
828 | },
829 | {
830 | "verbose": "model",
831 | "name": "model",
832 | "control": {
833 | "text": true
834 | },
835 | "type": "varchar(45)",
836 | "allowNull": false,
837 | "defaultValue": null,
838 | "listview": {
839 | "show": true
840 | },
841 | "editview": {
842 | "show": true
843 | }
844 | }
845 | ],
846 | "mainview": {
847 | "show": true
848 | },
849 | "listview": {
850 | "order": {},
851 | "page": 25
852 | },
853 | "editview": {
854 | "readonly": false,
855 | "manyToOne": {
856 | "repair": "car_id",
857 | "driver": "car_id"
858 | }
859 | }
860 | },
861 | "driver": {
862 | "slug": "driver",
863 | "table": {
864 | "name": "driver",
865 | "pk": "id",
866 | "verbose": "driver"
867 | },
868 | "columns": [
869 | {
870 | "verbose": "id",
871 | "name": "id",
872 | "control": {
873 | "text": true
874 | },
875 | "type": "int(11)",
876 | "allowNull": false,
877 | "defaultValue": null,
878 | "listview": {
879 | "show": true
880 | },
881 | "editview": {
882 | "show": false
883 | }
884 | },
885 | {
886 | "verbose": "car_id",
887 | "name": "car_id",
888 | "control": {
889 | "text": true
890 | },
891 | "type": "int(11)",
892 | "allowNull": false,
893 | "defaultValue": null,
894 | "listview": {
895 | "show": true
896 | },
897 | "editview": {
898 | "show": false
899 | }
900 | },
901 | {
902 | "verbose": "name",
903 | "name": "name",
904 | "control": {
905 | "text": true
906 | },
907 | "type": "varchar(45)",
908 | "allowNull": false,
909 | "defaultValue": null,
910 | "listview": {
911 | "show": true
912 | },
913 | "editview": {
914 | "show": true
915 | }
916 | }
917 | ],
918 | "mainview": {
919 | "show": false
920 | },
921 | "listview": {
922 | "order": {},
923 | "page": 25
924 | },
925 | "editview": {
926 | "readonly": false
927 | }
928 | },
929 | "repair": {
930 | "slug": "repair",
931 | "table": {
932 | "name": "repair",
933 | "pk": "id",
934 | "verbose": "repair"
935 | },
936 | "columns": [
937 | {
938 | "verbose": "id",
939 | "name": "id",
940 | "control": {
941 | "text": true
942 | },
943 | "type": "int(11)",
944 | "allowNull": false,
945 | "defaultValue": null,
946 | "listview": {
947 | "show": true
948 | },
949 | "editview": {
950 | "show": false
951 | }
952 | },
953 | {
954 | "verbose": "car_id",
955 | "name": "car_id",
956 | "control": {
957 | "text": true
958 | },
959 | "type": "int(11)",
960 | "allowNull": false,
961 | "defaultValue": null,
962 | "listview": {
963 | "show": true
964 | },
965 | "editview": {
966 | "show": false
967 | }
968 | },
969 | {
970 | "verbose": "date",
971 | "name": "date",
972 | "control": {
973 | "date": true
974 | },
975 | "type": "date",
976 | "allowNull": false,
977 | "defaultValue": null,
978 | "listview": {
979 | "show": true
980 | },
981 | "editview": {
982 | "show": true
983 | }
984 | }
985 | ],
986 | "mainview": {
987 | "show": false
988 | },
989 | "listview": {
990 | "order": {},
991 | "page": 25
992 | },
993 | "editview": {
994 | "readonly": false
995 | }
996 | },
997 | "controls": {
998 | "slug": "controls",
999 | "table": {
1000 | "name": "controls",
1001 | "pk": "id",
1002 | "verbose": "Controls"
1003 | },
1004 | "columns": [
1005 | {
1006 | "name": "id",
1007 | "verbose": "id",
1008 | "control": {
1009 | "text": true
1010 | },
1011 | "type": "int(11)",
1012 | "allowNull": false,
1013 | "defaultValue": null,
1014 | "listview": {
1015 | "show": true
1016 | },
1017 | "editview": {
1018 | "show": false
1019 | }
1020 | },
1021 | {
1022 | "name": "controls_otm_single_id",
1023 | "verbose": "one to many single",
1024 | "control": {
1025 | "select": true
1026 | },
1027 | "oneToMany": {
1028 | "table": "controls_otm_single",
1029 | "pk": "id",
1030 | "columns": [
1031 | "name"
1032 | ]
1033 | },
1034 | "type": "int(11)",
1035 | "allowNull": true,
1036 | "defaultValue": null,
1037 | "listview": {
1038 | "show": true
1039 | },
1040 | "editview": {
1041 | "show": true
1042 | }
1043 | },
1044 | {
1045 | "name": "controls_otm_multiple_id",
1046 | "verbose": "one to many multiple",
1047 | "control": {
1048 | "select": true
1049 | },
1050 | "oneToMany": {
1051 | "table": "controls_otm_multiple",
1052 | "pk": "id",
1053 | "columns": [
1054 | "first",
1055 | "last"
1056 | ]
1057 | },
1058 | "type": "int(11)",
1059 | "allowNull": true,
1060 | "defaultValue": null,
1061 | "listview": {
1062 | "show": true
1063 | },
1064 | "editview": {
1065 | "show": true
1066 | }
1067 | },
1068 | {
1069 | "verbose": "many to many single",
1070 | "name": "controls_mtm_single",
1071 | "control": {
1072 | "select": true,
1073 | "multiple": true
1074 | },
1075 | "type": "int(11)",
1076 | "allowNull": true,
1077 | "listview": {
1078 | "show": true
1079 | },
1080 | "editview": {
1081 | "show": true
1082 | },
1083 | "manyToMany": {
1084 | "link": {
1085 | "table": "controls_has_controls_mtm_single",
1086 | "parentPk": "controls_id",
1087 | "childPk": "controls_mtm_single_id"
1088 | },
1089 | "ref": {
1090 | "table": "controls_mtm_single",
1091 | "pk": "id",
1092 | "columns": [
1093 | "name"
1094 | ]
1095 | }
1096 | }
1097 | },
1098 | {
1099 | "verbose": "many to many multiple",
1100 | "name": "controls_mtm_multiple",
1101 | "control": {
1102 | "select": true,
1103 | "multiple": true
1104 | },
1105 | "type": "int(11)",
1106 | "allowNull": true,
1107 | "listview": {
1108 | "show": true
1109 | },
1110 | "editview": {
1111 | "show": true
1112 | },
1113 | "manyToMany": {
1114 | "link": {
1115 | "table": "controls_has_controls_mtm_multiple",
1116 | "parentPk": "controls_id",
1117 | "childPk": "controls_mtm_multiple_id"
1118 | },
1119 | "ref": {
1120 | "table": "controls_mtm_multiple",
1121 | "pk": "id",
1122 | "columns": [
1123 | "first",
1124 | "last"
1125 | ]
1126 | }
1127 | }
1128 | },
1129 | {
1130 | "name": "static",
1131 | "verbose": "static",
1132 | "control": {
1133 | "select": true,
1134 | "options": [
1135 | "one",
1136 | "two",
1137 | "three"
1138 | ]
1139 | },
1140 | "type": "varchar(45)",
1141 | "allowNull": true,
1142 | "defaultValue": null,
1143 | "listview": {
1144 | "show": true
1145 | },
1146 | "editview": {
1147 | "show": true
1148 | }
1149 | },
1150 | {
1151 | "name": "text",
1152 | "verbose": "text",
1153 | "control": {
1154 | "text": true
1155 | },
1156 | "type": "varchar(45)",
1157 | "allowNull": true,
1158 | "defaultValue": null,
1159 | "listview": {
1160 | "show": true
1161 | },
1162 | "editview": {
1163 | "show": true
1164 | }
1165 | },
1166 | {
1167 | "name": "boolean",
1168 | "verbose": "boolean",
1169 | "control": {
1170 | "radio": true,
1171 | "options": [
1172 | "Yes",
1173 | "No"
1174 | ]
1175 | },
1176 | "type": "char",
1177 | "allowNull": true,
1178 | "defaultValue": null,
1179 | "listview": {
1180 | "show": true
1181 | },
1182 | "editview": {
1183 | "show": true
1184 | }
1185 | },
1186 | {
1187 | "name": "bigint",
1188 | "verbose": "bigint",
1189 | "control": {
1190 | "number": true
1191 | },
1192 | "type": "bigint",
1193 | "allowNull": true,
1194 | "defaultValue": null,
1195 | "listview": {
1196 | "show": true
1197 | },
1198 | "editview": {
1199 | "show": true
1200 | }
1201 | },
1202 | {
1203 | "name": "double",
1204 | "verbose": "double",
1205 | "control": {
1206 | "number": true
1207 | },
1208 | "type": "double",
1209 | "allowNull": true,
1210 | "defaultValue": null,
1211 | "listview": {
1212 | "show": true
1213 | },
1214 | "editview": {
1215 | "show": true
1216 | }
1217 | },
1218 | {
1219 | "name": "upload",
1220 | "verbose": "upload",
1221 | "control": {
1222 | "file": true
1223 | },
1224 | "type": "varchar(45)",
1225 | "allowNull": true,
1226 | "defaultValue": null,
1227 | "listview": {
1228 | "show": true
1229 | },
1230 | "editview": {
1231 | "show": true
1232 | }
1233 | },
1234 | {
1235 | "name": "binary",
1236 | "verbose": "binary",
1237 | "control": {
1238 | "file": true,
1239 | "binary": true
1240 | },
1241 | "type": "bytea",
1242 | "allowNull": true,
1243 | "defaultValue": null,
1244 | "listview": {
1245 | "show": true
1246 | },
1247 | "editview": {
1248 | "show": true
1249 | }
1250 | },
1251 | {
1252 | "name": "date",
1253 | "verbose": "date",
1254 | "control": {
1255 | "date": true
1256 | },
1257 | "type": "date",
1258 | "allowNull": true,
1259 | "defaultValue": null,
1260 | "listview": {
1261 | "show": true
1262 | },
1263 | "editview": {
1264 | "show": true
1265 | }
1266 | },
1267 | {
1268 | "name": "time",
1269 | "verbose": "time",
1270 | "control": {
1271 | "time": true
1272 | },
1273 | "type": "time",
1274 | "allowNull": true,
1275 | "defaultValue": null,
1276 | "listview": {
1277 | "show": true
1278 | },
1279 | "editview": {
1280 | "show": true
1281 | }
1282 | },
1283 | {
1284 | "name": "datetime",
1285 | "verbose": "datetime",
1286 | "control": {
1287 | "datetime": true
1288 | },
1289 | "type": "datetime",
1290 | "allowNull": true,
1291 | "defaultValue": null,
1292 | "listview": {
1293 | "show": true
1294 | },
1295 | "editview": {
1296 | "show": true
1297 | }
1298 | },
1299 | {
1300 | "name": "textarea",
1301 | "verbose": "textarea",
1302 | "control": {
1303 | "textarea": true,
1304 | "editor": "ck-compact"
1305 | },
1306 | "type": "text",
1307 | "allowNull": true,
1308 | "defaultValue": null,
1309 | "listview": {
1310 | "show": true
1311 | },
1312 | "editview": {
1313 | "show": true
1314 | }
1315 | }
1316 | ],
1317 | "mainview": {
1318 | "show": true
1319 | },
1320 | "listview": {
1321 | "order": {},
1322 | "page": 25,
1323 | "filter": [
1324 | "controls_otm_single_id",
1325 | "controls_otm_multiple_id",
1326 | "controls_mtm_single",
1327 | "controls_mtm_multiple",
1328 | "static",
1329 | "text",
1330 | "boolean",
1331 | "bigint",
1332 | "double",
1333 | "upload",
1334 | "date",
1335 | "time",
1336 | "datetime",
1337 | "year",
1338 | "textarea"
1339 | ]
1340 | },
1341 | "editview": {
1342 | "readonly": false,
1343 | "manyToOne": {
1344 | "controls_inline": "controls_id"
1345 | }
1346 | }
1347 | },
1348 | "controls_has_controls_mtm_multiple": {
1349 | "slug": "controls_has_controls_mtm_multiple",
1350 | "table": {
1351 | "name": "controls_has_controls_mtm_multiple",
1352 | "pk": "controls_id",
1353 | "verbose": "controls_has_controls_mtm_multiple"
1354 | },
1355 | "columns": [
1356 | {
1357 | "name": "controls_id",
1358 | "verbose": "controls_id",
1359 | "control": {
1360 | "text": true
1361 | },
1362 | "type": "int(11)",
1363 | "allowNull": false,
1364 | "defaultValue": null,
1365 | "listview": {
1366 | "show": true
1367 | },
1368 | "editview": {
1369 | "show": true
1370 | }
1371 | },
1372 | {
1373 | "name": "controls_mtm_multiple_id",
1374 | "verbose": "controls_mtm_multiple_id",
1375 | "control": {
1376 | "text": true
1377 | },
1378 | "type": "int(11)",
1379 | "allowNull": false,
1380 | "defaultValue": null,
1381 | "listview": {
1382 | "show": true
1383 | },
1384 | "editview": {
1385 | "show": true
1386 | }
1387 | }
1388 | ],
1389 | "mainview": {
1390 | "show": false
1391 | },
1392 | "listview": {
1393 | "order": {},
1394 | "page": 25
1395 | },
1396 | "editview": {
1397 | "readonly": false
1398 | }
1399 | },
1400 | "controls_has_controls_mtm_single": {
1401 | "slug": "controls_has_controls_mtm_single",
1402 | "table": {
1403 | "name": "controls_has_controls_mtm_single",
1404 | "pk": "controls_id",
1405 | "verbose": "controls_has_controls_mtm_single"
1406 | },
1407 | "columns": [
1408 | {
1409 | "name": "controls_id",
1410 | "verbose": "controls_id",
1411 | "control": {
1412 | "text": true
1413 | },
1414 | "type": "int(11)",
1415 | "allowNull": false,
1416 | "defaultValue": null,
1417 | "listview": {
1418 | "show": true
1419 | },
1420 | "editview": {
1421 | "show": true
1422 | }
1423 | },
1424 | {
1425 | "name": "controls_mtm_single_id",
1426 | "verbose": "controls_mtm_single_id",
1427 | "control": {
1428 | "text": true
1429 | },
1430 | "type": "int(11)",
1431 | "allowNull": false,
1432 | "defaultValue": null,
1433 | "listview": {
1434 | "show": true
1435 | },
1436 | "editview": {
1437 | "show": true
1438 | }
1439 | }
1440 | ],
1441 | "mainview": {
1442 | "show": false
1443 | },
1444 | "listview": {
1445 | "order": {},
1446 | "page": 25
1447 | },
1448 | "editview": {
1449 | "readonly": false
1450 | }
1451 | },
1452 | "controls_inline": {
1453 | "slug": "controls_inline",
1454 | "table": {
1455 | "name": "controls_inline",
1456 | "pk": "id",
1457 | "verbose": "inline controls"
1458 | },
1459 | "columns": [
1460 | {
1461 | "name": "id",
1462 | "verbose": "id",
1463 | "control": {
1464 | "text": true
1465 | },
1466 | "type": "int(11)",
1467 | "allowNull": false,
1468 | "defaultValue": null,
1469 | "listview": {
1470 | "show": true
1471 | },
1472 | "editview": {
1473 | "show": false
1474 | }
1475 | },
1476 | {
1477 | "name": "controls_id",
1478 | "verbose": "controls_id",
1479 | "control": {
1480 | "text": true
1481 | },
1482 | "type": "int(11)",
1483 | "allowNull": false,
1484 | "defaultValue": null,
1485 | "listview": {
1486 | "show": true
1487 | },
1488 | "editview": {
1489 | "show": false
1490 | }
1491 | },
1492 | {
1493 | "name": "controls_inline_otm_single_id",
1494 | "verbose": "one to many single",
1495 | "control": {
1496 | "select": true
1497 | },
1498 | "oneToMany": {
1499 | "table": "controls_inline_otm_single",
1500 | "pk": "id",
1501 | "columns": [
1502 | "name"
1503 | ]
1504 | },
1505 | "type": "int(11)",
1506 | "allowNull": false,
1507 | "defaultValue": null,
1508 | "listview": {
1509 | "show": true
1510 | },
1511 | "editview": {
1512 | "show": true
1513 | }
1514 | },
1515 | {
1516 | "name": "controls_inline_otm_multiple_id",
1517 | "verbose": "one to many multiple",
1518 | "control": {
1519 | "select": true
1520 | },
1521 | "oneToMany": {
1522 | "table": "controls_inline_otm_multiple",
1523 | "pk": "id",
1524 | "columns": [
1525 | "first",
1526 | "last"
1527 | ]
1528 | },
1529 | "type": "int(11)",
1530 | "allowNull": false,
1531 | "defaultValue": null,
1532 | "listview": {
1533 | "show": true
1534 | },
1535 | "editview": {
1536 | "show": true
1537 | }
1538 | },
1539 | {
1540 | "verbose": "many to many single",
1541 | "name": "controls_inline_mtm_single",
1542 | "control": {
1543 | "select": true,
1544 | "multiple": true
1545 | },
1546 | "type": "int(11)",
1547 | "allowNull": false,
1548 | "listview": {
1549 | "show": true
1550 | },
1551 | "editview": {
1552 | "show": true
1553 | },
1554 | "manyToMany": {
1555 | "link": {
1556 | "table": "controls_inline_has_controls_inline_mtm_single",
1557 | "parentPk": "controls_inline_id",
1558 | "childPk": "controls_inline_mtm_single_id"
1559 | },
1560 | "ref": {
1561 | "table": "controls_inline_mtm_single",
1562 | "pk": "id",
1563 | "columns": [
1564 | "name"
1565 | ]
1566 | }
1567 | }
1568 | },
1569 | {
1570 | "verbose": "many to many multiple",
1571 | "name": "controls_inline_mtm_multiple",
1572 | "control": {
1573 | "select": true,
1574 | "multiple": true
1575 | },
1576 | "type": "int(11)",
1577 | "allowNull": false,
1578 | "listview": {
1579 | "show": true
1580 | },
1581 | "editview": {
1582 | "show": true
1583 | },
1584 | "manyToMany": {
1585 | "link": {
1586 | "table": "controls_inline_has_controls_inline_mtm_multiple",
1587 | "parentPk": "controls_inline_id",
1588 | "childPk": "controls_inline_mtm_multiple_id"
1589 | },
1590 | "ref": {
1591 | "table": "controls_inline_mtm_multiple",
1592 | "pk": "id",
1593 | "columns": [
1594 | "first",
1595 | "last"
1596 | ]
1597 | }
1598 | }
1599 | },
1600 | {
1601 | "name": "static",
1602 | "verbose": "static",
1603 | "control": {
1604 | "select": true,
1605 | "options": [
1606 | "one",
1607 | "two",
1608 | "three"
1609 | ]
1610 | },
1611 | "type": "varchar(45)",
1612 | "allowNull": false,
1613 | "defaultValue": null,
1614 | "listview": {
1615 | "show": true
1616 | },
1617 | "editview": {
1618 | "show": true
1619 | }
1620 | },
1621 | {
1622 | "name": "text",
1623 | "verbose": "text",
1624 | "control": {
1625 | "text": true
1626 | },
1627 | "type": "varchar(45)",
1628 | "allowNull": false,
1629 | "defaultValue": null,
1630 | "listview": {
1631 | "show": true
1632 | },
1633 | "editview": {
1634 | "show": true
1635 | }
1636 | },
1637 | {
1638 | "name": "boolean",
1639 | "verbose": "boolean",
1640 | "control": {
1641 | "radio": true,
1642 | "options": [
1643 | "Yes",
1644 | "No"
1645 | ]
1646 | },
1647 | "type": "char",
1648 | "allowNull": false,
1649 | "defaultValue": null,
1650 | "listview": {
1651 | "show": true
1652 | },
1653 | "editview": {
1654 | "show": true
1655 | }
1656 | },
1657 | {
1658 | "name": "bigint",
1659 | "verbose": "bigint",
1660 | "control": {
1661 | "number": true
1662 | },
1663 | "type": "bigint",
1664 | "allowNull": false,
1665 | "defaultValue": null,
1666 | "listview": {
1667 | "show": true
1668 | },
1669 | "editview": {
1670 | "show": true
1671 | }
1672 | },
1673 | {
1674 | "name": "double",
1675 | "verbose": "double",
1676 | "control": {
1677 | "number": true
1678 | },
1679 | "type": "double",
1680 | "allowNull": false,
1681 | "defaultValue": null,
1682 | "listview": {
1683 | "show": true
1684 | },
1685 | "editview": {
1686 | "show": true
1687 | }
1688 | },
1689 | {
1690 | "name": "upload",
1691 | "verbose": "upload",
1692 | "control": {
1693 | "file": true
1694 | },
1695 | "type": "varchar(45)",
1696 | "allowNull": false,
1697 | "defaultValue": null,
1698 | "listview": {
1699 | "show": true
1700 | },
1701 | "editview": {
1702 | "show": true
1703 | }
1704 | },
1705 | {
1706 | "name": "binary",
1707 | "verbose": "binary",
1708 | "control": {
1709 | "file": true,
1710 | "binary": true
1711 | },
1712 | "type": "bytea",
1713 | "allowNull": false,
1714 | "defaultValue": null,
1715 | "listview": {
1716 | "show": true
1717 | },
1718 | "editview": {
1719 | "show": true
1720 | }
1721 | },
1722 | {
1723 | "name": "date",
1724 | "verbose": "date",
1725 | "control": {
1726 | "date": true
1727 | },
1728 | "type": "date",
1729 | "allowNull": false,
1730 | "defaultValue": null,
1731 | "listview": {
1732 | "show": true
1733 | },
1734 | "editview": {
1735 | "show": true
1736 | }
1737 | },
1738 | {
1739 | "name": "time",
1740 | "verbose": "time",
1741 | "control": {
1742 | "time": true
1743 | },
1744 | "type": "time",
1745 | "allowNull": false,
1746 | "defaultValue": null,
1747 | "listview": {
1748 | "show": true
1749 | },
1750 | "editview": {
1751 | "show": true
1752 | }
1753 | },
1754 | {
1755 | "name": "datetime",
1756 | "verbose": "datetime",
1757 | "control": {
1758 | "datetime": true
1759 | },
1760 | "type": "datetime",
1761 | "allowNull": false,
1762 | "defaultValue": null,
1763 | "listview": {
1764 | "show": true
1765 | },
1766 | "editview": {
1767 | "show": true
1768 | }
1769 | },
1770 | {
1771 | "name": "textarea",
1772 | "verbose": "textarea",
1773 | "control": {
1774 | "textarea": true,
1775 | "editor": "ck-compact"
1776 | },
1777 | "type": "text",
1778 | "allowNull": false,
1779 | "defaultValue": null,
1780 | "listview": {
1781 | "show": true
1782 | },
1783 | "editview": {
1784 | "show": true
1785 | }
1786 | }
1787 | ],
1788 | "mainview": {
1789 | "show": false
1790 | },
1791 | "listview": {
1792 | "order": {},
1793 | "page": 25
1794 | },
1795 | "editview": {
1796 | "readonly": false
1797 | }
1798 | },
1799 | "controls_inline_has_controls_inline_mtm_multiple": {
1800 | "slug": "controls_inline_has_controls_inline_mtm_multiple",
1801 | "table": {
1802 | "name": "controls_inline_has_controls_inline_mtm_multiple",
1803 | "pk": "controls_inline_id",
1804 | "verbose": "controls_inline_has_controls_inline_mtm_multiple"
1805 | },
1806 | "columns": [
1807 | {
1808 | "name": "controls_inline_id",
1809 | "verbose": "controls_inline_id",
1810 | "control": {
1811 | "text": true
1812 | },
1813 | "type": "int(11)",
1814 | "allowNull": false,
1815 | "defaultValue": null,
1816 | "listview": {
1817 | "show": true
1818 | },
1819 | "editview": {
1820 | "show": true
1821 | }
1822 | },
1823 | {
1824 | "name": "controls_inline_mtm_multiple_id",
1825 | "verbose": "controls_inline_mtm_multiple_id",
1826 | "control": {
1827 | "text": true
1828 | },
1829 | "type": "int(11)",
1830 | "allowNull": false,
1831 | "defaultValue": null,
1832 | "listview": {
1833 | "show": true
1834 | },
1835 | "editview": {
1836 | "show": true
1837 | }
1838 | }
1839 | ],
1840 | "mainview": {
1841 | "show": false
1842 | },
1843 | "listview": {
1844 | "order": {},
1845 | "page": 25
1846 | },
1847 | "editview": {
1848 | "readonly": false
1849 | }
1850 | },
1851 | "controls_inline_has_controls_inline_mtm_single": {
1852 | "slug": "controls_inline_has_controls_inline_mtm_single",
1853 | "table": {
1854 | "name": "controls_inline_has_controls_inline_mtm_single",
1855 | "pk": "controls_inline_id",
1856 | "verbose": "controls_inline_has_controls_inline_mtm_single"
1857 | },
1858 | "columns": [
1859 | {
1860 | "name": "controls_inline_id",
1861 | "verbose": "controls_inline_id",
1862 | "control": {
1863 | "text": true
1864 | },
1865 | "type": "int(11)",
1866 | "allowNull": false,
1867 | "defaultValue": null,
1868 | "listview": {
1869 | "show": true
1870 | },
1871 | "editview": {
1872 | "show": true
1873 | }
1874 | },
1875 | {
1876 | "name": "controls_inline_mtm_single_id",
1877 | "verbose": "controls_inline_mtm_single_id",
1878 | "control": {
1879 | "text": true
1880 | },
1881 | "type": "int(11)",
1882 | "allowNull": false,
1883 | "defaultValue": null,
1884 | "listview": {
1885 | "show": true
1886 | },
1887 | "editview": {
1888 | "show": true
1889 | }
1890 | }
1891 | ],
1892 | "mainview": {
1893 | "show": false
1894 | },
1895 | "listview": {
1896 | "order": {},
1897 | "page": 25
1898 | },
1899 | "editview": {
1900 | "readonly": false
1901 | }
1902 | },
1903 | "controls_inline_mtm_multiple": {
1904 | "slug": "controls_inline_mtm_multiple",
1905 | "table": {
1906 | "name": "controls_inline_mtm_multiple",
1907 | "pk": "id",
1908 | "verbose": "controls_inline_mtm_multiple"
1909 | },
1910 | "columns": [
1911 | {
1912 | "name": "id",
1913 | "verbose": "id",
1914 | "control": {
1915 | "text": true
1916 | },
1917 | "type": "int(11)",
1918 | "allowNull": false,
1919 | "defaultValue": null,
1920 | "listview": {
1921 | "show": true
1922 | },
1923 | "editview": {
1924 | "show": true
1925 | }
1926 | },
1927 | {
1928 | "name": "first",
1929 | "verbose": "first",
1930 | "control": {
1931 | "text": true
1932 | },
1933 | "type": "varchar(45)",
1934 | "allowNull": false,
1935 | "defaultValue": null,
1936 | "listview": {
1937 | "show": true
1938 | },
1939 | "editview": {
1940 | "show": true
1941 | }
1942 | },
1943 | {
1944 | "name": "last",
1945 | "verbose": "last",
1946 | "control": {
1947 | "text": true
1948 | },
1949 | "type": "varchar(45)",
1950 | "allowNull": true,
1951 | "defaultValue": null,
1952 | "listview": {
1953 | "show": true
1954 | },
1955 | "editview": {
1956 | "show": true
1957 | }
1958 | }
1959 | ],
1960 | "mainview": {
1961 | "show": false
1962 | },
1963 | "listview": {
1964 | "order": {},
1965 | "page": 25
1966 | },
1967 | "editview": {
1968 | "readonly": false
1969 | }
1970 | },
1971 | "controls_inline_mtm_single": {
1972 | "slug": "controls_inline_mtm_single",
1973 | "table": {
1974 | "name": "controls_inline_mtm_single",
1975 | "pk": "id",
1976 | "verbose": "controls_inline_mtm_single"
1977 | },
1978 | "columns": [
1979 | {
1980 | "name": "id",
1981 | "verbose": "id",
1982 | "control": {
1983 | "text": true
1984 | },
1985 | "type": "int(11)",
1986 | "allowNull": false,
1987 | "defaultValue": null,
1988 | "listview": {
1989 | "show": true
1990 | },
1991 | "editview": {
1992 | "show": true
1993 | }
1994 | },
1995 | {
1996 | "name": "name",
1997 | "verbose": "name",
1998 | "control": {
1999 | "text": true
2000 | },
2001 | "type": "varchar(45)",
2002 | "allowNull": false,
2003 | "defaultValue": null,
2004 | "listview": {
2005 | "show": true
2006 | },
2007 | "editview": {
2008 | "show": true
2009 | }
2010 | }
2011 | ],
2012 | "mainview": {
2013 | "show": false
2014 | },
2015 | "listview": {
2016 | "order": {},
2017 | "page": 25
2018 | },
2019 | "editview": {
2020 | "readonly": false
2021 | }
2022 | },
2023 | "controls_inline_otm_multiple": {
2024 | "slug": "controls_inline_otm_multiple",
2025 | "table": {
2026 | "name": "controls_inline_otm_multiple",
2027 | "pk": "id",
2028 | "verbose": "controls_inline_otm_multiple"
2029 | },
2030 | "columns": [
2031 | {
2032 | "name": "id",
2033 | "verbose": "id",
2034 | "control": {
2035 | "text": true
2036 | },
2037 | "type": "int(11)",
2038 | "allowNull": false,
2039 | "defaultValue": null,
2040 | "listview": {
2041 | "show": true
2042 | },
2043 | "editview": {
2044 | "show": true
2045 | }
2046 | },
2047 | {
2048 | "name": "first",
2049 | "verbose": "first",
2050 | "control": {
2051 | "text": true
2052 | },
2053 | "type": "varchar(45)",
2054 | "allowNull": false,
2055 | "defaultValue": null,
2056 | "listview": {
2057 | "show": true
2058 | },
2059 | "editview": {
2060 | "show": true
2061 | }
2062 | },
2063 | {
2064 | "name": "last",
2065 | "verbose": "last",
2066 | "control": {
2067 | "text": true
2068 | },
2069 | "type": "varchar(45)",
2070 | "allowNull": true,
2071 | "defaultValue": null,
2072 | "listview": {
2073 | "show": true
2074 | },
2075 | "editview": {
2076 | "show": true
2077 | }
2078 | }
2079 | ],
2080 | "mainview": {
2081 | "show": false
2082 | },
2083 | "listview": {
2084 | "order": {},
2085 | "page": 25
2086 | },
2087 | "editview": {
2088 | "readonly": false
2089 | }
2090 | },
2091 | "controls_inline_otm_single": {
2092 | "slug": "controls_inline_otm_single",
2093 | "table": {
2094 | "name": "controls_inline_otm_single",
2095 | "pk": "id",
2096 | "verbose": "controls_inline_otm_single"
2097 | },
2098 | "columns": [
2099 | {
2100 | "name": "id",
2101 | "verbose": "id",
2102 | "control": {
2103 | "text": true
2104 | },
2105 | "type": "int(11)",
2106 | "allowNull": false,
2107 | "defaultValue": null,
2108 | "listview": {
2109 | "show": true
2110 | },
2111 | "editview": {
2112 | "show": true
2113 | }
2114 | },
2115 | {
2116 | "name": "name",
2117 | "verbose": "name",
2118 | "control": {
2119 | "text": true
2120 | },
2121 | "type": "varchar(45)",
2122 | "allowNull": false,
2123 | "defaultValue": null,
2124 | "listview": {
2125 | "show": true
2126 | },
2127 | "editview": {
2128 | "show": true
2129 | }
2130 | }
2131 | ],
2132 | "mainview": {
2133 | "show": false
2134 | },
2135 | "listview": {
2136 | "order": {},
2137 | "page": 25
2138 | },
2139 | "editview": {
2140 | "readonly": false
2141 | }
2142 | },
2143 | "controls_mtm_multiple": {
2144 | "slug": "controls_mtm_multiple",
2145 | "table": {
2146 | "name": "controls_mtm_multiple",
2147 | "pk": "id",
2148 | "verbose": "controls_mtm_multiple"
2149 | },
2150 | "columns": [
2151 | {
2152 | "name": "id",
2153 | "verbose": "id",
2154 | "control": {
2155 | "text": true
2156 | },
2157 | "type": "int(11)",
2158 | "allowNull": false,
2159 | "defaultValue": null,
2160 | "listview": {
2161 | "show": true
2162 | },
2163 | "editview": {
2164 | "show": true
2165 | }
2166 | },
2167 | {
2168 | "name": "first",
2169 | "verbose": "first",
2170 | "control": {
2171 | "text": true
2172 | },
2173 | "type": "varchar(45)",
2174 | "allowNull": false,
2175 | "defaultValue": null,
2176 | "listview": {
2177 | "show": true
2178 | },
2179 | "editview": {
2180 | "show": true
2181 | }
2182 | },
2183 | {
2184 | "name": "last",
2185 | "verbose": "last",
2186 | "control": {
2187 | "text": true
2188 | },
2189 | "type": "varchar(45)",
2190 | "allowNull": true,
2191 | "defaultValue": null,
2192 | "listview": {
2193 | "show": true
2194 | },
2195 | "editview": {
2196 | "show": true
2197 | }
2198 | }
2199 | ],
2200 | "mainview": {
2201 | "show": false
2202 | },
2203 | "listview": {
2204 | "order": {},
2205 | "page": 25
2206 | },
2207 | "editview": {
2208 | "readonly": false
2209 | }
2210 | },
2211 | "controls_mtm_single": {
2212 | "slug": "controls_mtm_single",
2213 | "table": {
2214 | "name": "controls_mtm_single",
2215 | "pk": "id",
2216 | "verbose": "controls_mtm_single"
2217 | },
2218 | "columns": [
2219 | {
2220 | "name": "id",
2221 | "verbose": "id",
2222 | "control": {
2223 | "text": true
2224 | },
2225 | "type": "int(11)",
2226 | "allowNull": false,
2227 | "defaultValue": null,
2228 | "listview": {
2229 | "show": true
2230 | },
2231 | "editview": {
2232 | "show": true
2233 | }
2234 | },
2235 | {
2236 | "name": "name",
2237 | "verbose": "name",
2238 | "control": {
2239 | "text": true
2240 | },
2241 | "type": "varchar(45)",
2242 | "allowNull": false,
2243 | "defaultValue": null,
2244 | "listview": {
2245 | "show": true
2246 | },
2247 | "editview": {
2248 | "show": true
2249 | }
2250 | }
2251 | ],
2252 | "mainview": {
2253 | "show": false
2254 | },
2255 | "listview": {
2256 | "order": {},
2257 | "page": 25
2258 | },
2259 | "editview": {
2260 | "readonly": false
2261 | }
2262 | },
2263 | "controls_otm_multiple": {
2264 | "slug": "controls_otm_multiple",
2265 | "table": {
2266 | "name": "controls_otm_multiple",
2267 | "pk": "id",
2268 | "verbose": "controls_otm_multiple"
2269 | },
2270 | "columns": [
2271 | {
2272 | "name": "id",
2273 | "verbose": "id",
2274 | "control": {
2275 | "text": true
2276 | },
2277 | "type": "int(11)",
2278 | "allowNull": false,
2279 | "defaultValue": null,
2280 | "listview": {
2281 | "show": true
2282 | },
2283 | "editview": {
2284 | "show": true
2285 | }
2286 | },
2287 | {
2288 | "name": "first",
2289 | "verbose": "first",
2290 | "control": {
2291 | "text": true
2292 | },
2293 | "type": "varchar(45)",
2294 | "allowNull": false,
2295 | "defaultValue": null,
2296 | "listview": {
2297 | "show": true
2298 | },
2299 | "editview": {
2300 | "show": true
2301 | }
2302 | },
2303 | {
2304 | "name": "last",
2305 | "verbose": "last",
2306 | "control": {
2307 | "text": true
2308 | },
2309 | "type": "varchar(45)",
2310 | "allowNull": true,
2311 | "defaultValue": null,
2312 | "listview": {
2313 | "show": true
2314 | },
2315 | "editview": {
2316 | "show": true
2317 | }
2318 | }
2319 | ],
2320 | "mainview": {
2321 | "show": false
2322 | },
2323 | "listview": {
2324 | "order": {},
2325 | "page": 25
2326 | },
2327 | "editview": {
2328 | "readonly": false
2329 | }
2330 | },
2331 | "controls_otm_single": {
2332 | "slug": "controls_otm_single",
2333 | "table": {
2334 | "name": "controls_otm_single",
2335 | "pk": "id",
2336 | "verbose": "controls_otm_single"
2337 | },
2338 | "columns": [
2339 | {
2340 | "name": "id",
2341 | "verbose": "id",
2342 | "control": {
2343 | "text": true
2344 | },
2345 | "type": "int(11)",
2346 | "allowNull": false,
2347 | "defaultValue": null,
2348 | "listview": {
2349 | "show": true
2350 | },
2351 | "editview": {
2352 | "show": true
2353 | }
2354 | },
2355 | {
2356 | "name": "name",
2357 | "verbose": "name",
2358 | "control": {
2359 | "text": true
2360 | },
2361 | "type": "varchar(45)",
2362 | "allowNull": false,
2363 | "defaultValue": null,
2364 | "listview": {
2365 | "show": true
2366 | },
2367 | "editview": {
2368 | "show": true
2369 | }
2370 | }
2371 | ],
2372 | "mainview": {
2373 | "show": false
2374 | },
2375 | "listview": {
2376 | "order": {},
2377 | "page": 25
2378 | },
2379 | "editview": {
2380 | "readonly": false
2381 | }
2382 | },
2383 | "notes": {
2384 | "slug": "notes",
2385 | "table": {
2386 | "name": "notes",
2387 | "pk": "id",
2388 | "verbose": "Notes (Editors)"
2389 | },
2390 | "columns": [
2391 | {
2392 | "verbose": "id",
2393 | "name": "id",
2394 | "control": {
2395 | "text": true
2396 | },
2397 | "type": "int(11)",
2398 | "allowNull": false,
2399 | "defaultValue": null,
2400 | "listview": {
2401 | "show": true
2402 | },
2403 | "editview": {
2404 | "show": false
2405 | }
2406 | },
2407 | {
2408 | "verbose": "Textarea",
2409 | "name": "notes1",
2410 | "control": {
2411 | "textarea": true
2412 | },
2413 | "type": "text",
2414 | "allowNull": true,
2415 | "defaultValue": null,
2416 | "listview": {
2417 | "show": false
2418 | },
2419 | "editview": {
2420 | "show": true
2421 | }
2422 | },
2423 | {
2424 | "verbose": "CKEditor Full",
2425 | "name": "notes2",
2426 | "control": {
2427 | "textarea": true,
2428 | "editor": "ck-full"
2429 | },
2430 | "type": "text",
2431 | "allowNull": false,
2432 | "defaultValue": null,
2433 | "listview": {
2434 | "show": false
2435 | },
2436 | "editview": {
2437 | "show": true
2438 | }
2439 | },
2440 | {
2441 | "verbose": "CKEditor Compact",
2442 | "name": "notes3",
2443 | "control": {
2444 | "textarea": true,
2445 | "editor": "ck-compact"
2446 | },
2447 | "type": "text",
2448 | "allowNull": true,
2449 | "defaultValue": null,
2450 | "listview": {
2451 | "show": false
2452 | },
2453 | "editview": {
2454 | "show": true
2455 | }
2456 | },
2457 | {
2458 | "verbose": "TinyMCE",
2459 | "name": "notes4",
2460 | "control": {
2461 | "textarea": true,
2462 | "editor": "tinymce"
2463 | },
2464 | "type": "text",
2465 | "allowNull": false,
2466 | "defaultValue": null,
2467 | "listview": {
2468 | "show": false
2469 | },
2470 | "editview": {
2471 | "show": true
2472 | }
2473 | }
2474 | ],
2475 | "mainview": {
2476 | "show": true
2477 | },
2478 | "listview": {
2479 | "order": {},
2480 | "page": 25
2481 | },
2482 | "editview": {
2483 | "readonly": false
2484 | }
2485 | }
2486 | }
2487 |
--------------------------------------------------------------------------------