diff --git a/.dockerignore b/.dockerignore
index 9c7a4b47..d91131a9 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -11,8 +11,9 @@
**/dist
**/out
**/.idea
+**/.vscode
**/.kmigrator
+**/.turbo
**/docs
**/.config
-**/.yarn
**/.cache
diff --git a/.env.example b/.env.example
index 94d7710b..f66c35d0 100644
--- a/.env.example
+++ b/.env.example
@@ -1,18 +1,3 @@
#DATABASE_URL=mongodb://mongo:mongo@127.0.0.1/main?authSource=admin
-DATABASE_URL=postgresql://postgres:postgres@127.0.0.1/main
+#DATABASE_URL=postgresql://postgres:postgres@127.0.0.1/main
NODE_ENV=development
-DISABLE_LOGGING=true
-COOKIE_SECRET=random
-SERVER_URL=http://localhost:3000
-
-# production docker deploy envs!
-DOCKER_FILE_INSTALL_COMMAND="python3 -m pip install 'psycopg2-binary>=2.8.5' && python3 -m pip install 'Django>=3.0.6'"
-DOCKER_FILE_BUILD_COMMAND=yarn workspace @app/demo build
-DOCKER_COMPOSE_APP_IMAGE_TAG=demo
-DOCKER_COMPOSE_START_APP_COMMAND=yarn workspace @app/demo start
-#DOCKER_COMPOSE_DATABASE_URL=mongodb://mongo:mongo@mongodb/main?authSource=admin
-DOCKER_COMPOSE_DATABASE_URL=postgresql://postgres:postgres@postgresdb/main
-DOCKER_COMPOSE_COOKIE_SECRET=random
-# change it -------------------^
-DOCKER_COMPOSE_SERVER_URL=https://demo.dok.8iq.dev
-# change it -------------------^
diff --git a/.eslintignore b/.eslintignore
deleted file mode 100644
index 9f260d43..00000000
--- a/.eslintignore
+++ /dev/null
@@ -1,14 +0,0 @@
-apps/sberhack
-
-# Ignore artifacts
-**/.next
-**/node_modules
-**/out
-**/__generated__
-
-# Ignore test files
-**/test*
-
-# Ignore other files
-package.json
-README.md
diff --git a/.github/workflows/ci.build.yml b/.github/workflows/ci.build.yml
new file mode 100644
index 00000000..f3afae6d
--- /dev/null
+++ b/.github/workflows/ci.build.yml
@@ -0,0 +1,30 @@
+name: TEST BUILD
+
+on:
+ push:
+ branches: [ master ]
+ pull_request:
+ branches: [ master ]
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+
+ strategy:
+ matrix:
+ node-version: [16.x, 20.x]
+
+ steps:
+ - uses: actions/checkout@v4
+ - name: Use Node.js ${{ matrix.node-version }}
+ uses: actions/setup-node@v4
+ with:
+ node-version: ${{ matrix.node-version }}
+ - name: install packages
+ run: |
+ corepack enable
+ yarn set version stable
+ yarn install
+ - name: BUILD
+ run: yarn build
diff --git a/.github/workflows/ci.docker.yml b/.github/workflows/ci.docker.yml
new file mode 100644
index 00000000..9b19d1dc
--- /dev/null
+++ b/.github/workflows/ci.docker.yml
@@ -0,0 +1,23 @@
+name: TEST DOCKER
+
+on:
+ push:
+ branches: [ master ]
+ pull_request:
+ branches: [ master ]
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+ - name: install packages
+ run: docker-compose build
+
+ - name: Setup debug by SSH if failure ci session
+ uses: lhotari/action-upterm@v1
+ if: ${{ failure() }}
+ with:
+ wait-timeout-minutes: 5
diff --git a/.github/workflows/ci.linters.yml b/.github/workflows/ci.linters.yml
new file mode 100644
index 00000000..4a8ef0f1
--- /dev/null
+++ b/.github/workflows/ci.linters.yml
@@ -0,0 +1,30 @@
+name: LINTERS
+
+on:
+ push:
+ branches: [ master ]
+ pull_request:
+ branches: [ master ]
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+
+ strategy:
+ matrix:
+ node-version: [20.x]
+
+ steps:
+ - uses: actions/checkout@v4
+ - name: Use Node.js ${{ matrix.node-version }}
+ uses: actions/setup-node@v4
+ with:
+ node-version: ${{ matrix.node-version }}
+ - name: install packages
+ run: |
+ corepack enable
+ yarn set version stable
+ yarn install
+ - run: yarn format --check
+ - run: yarn lint
diff --git a/.github/workflows/nodejs.apps.demo.yml b/.github/workflows/nodejs.apps.demo.yml
deleted file mode 100644
index 160df58b..00000000
--- a/.github/workflows/nodejs.apps.demo.yml
+++ /dev/null
@@ -1,53 +0,0 @@
-# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
-# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
-
-name: RUN DEMO TESTS
-
-on:
- push:
- branches: [ master ]
- pull_request:
- branches: [ master ]
-
-jobs:
- build:
-
- runs-on: ubuntu-latest
-
- strategy:
- matrix:
- node-version: [12.x, 14.x]
- database: ["postgresql://postgres:postgres@127.0.0.1/main", "mongodb://mongo:mongo@127.0.0.1/main?authSource=admin"]
-
- steps:
- - uses: actions/checkout@v2
- - name: Prepare .env
- run: cp .env.example .env
- - name: Docker compose up databases
- run: docker-compose up -d mongodb postgresdb
- - name: Use Node.js ${{ matrix.node-version }}
- uses: actions/setup-node@v1
- with:
- node-version: ${{ matrix.node-version }}
- - name: install packages
- run: |
- yarn
- pip3 install django
- pip3 install psycopg2-binary
- - name: run tests for ${{ matrix.database }}
- run: |
- set -x
- # export DEBUG=knex:query,knex:tx
- # export DEBUG_MONGOOSE=1
- [[ $DATABASE_URL == postgresql* ]] && yarn workspace @app/demo migrate
- yarn workspace @app/demo dev &
- # Wait until server is up!
- while ! [[ $(curl -s 'http://localhost:3000/admin/api' --data-raw '{"operationName":null,"variables":{},"query":"{appVersion}"}' -H 'content-type: application/json') == *"appVersion"* ]]; do
- sleep 0.5
- done
- sleep 1
- yarn workspace @app/demo test
- env:
- DATABASE_URL: ${{ matrix.database }}
- NODE_ENV: development
- DISABLE_LOGGING: true
diff --git a/.github/workflows/nodejs.apps.front.yml b/.github/workflows/nodejs.apps.front.yml
deleted file mode 100644
index f5d02bc1..00000000
--- a/.github/workflows/nodejs.apps.front.yml
+++ /dev/null
@@ -1,32 +0,0 @@
-# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
-# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
-
-name: TEST FRONT APPS
-
-on:
- push:
- branches: [ master ]
- pull_request:
- branches: [ master ]
-
-jobs:
- build:
-
- runs-on: ubuntu-latest
-
- strategy:
- matrix:
- node-version: [12.x, 14.x]
-
- steps:
- - uses: actions/checkout@v2
- - name: Use Node.js ${{ matrix.node-version }}
- uses: actions/setup-node@v1
- with:
- node-version: ${{ matrix.node-version }}
- - run: yarn
- - name: Show all node_modules dirs
- run: find . -name "node_modules" -type d -prune | xargs ls -lah
- - run: yarn run jest ./packages
- - run: yarn workspace @app/ex01front test
- - run: yarn workspace @app/ex02front test
diff --git a/.github/workflows/nodejs.codestyle.yml b/.github/workflows/nodejs.codestyle.yml
deleted file mode 100644
index 74cb5682..00000000
--- a/.github/workflows/nodejs.codestyle.yml
+++ /dev/null
@@ -1,25 +0,0 @@
-name: LINTER
-
-on:
- push:
- branches: [ master ]
- pull_request:
- branches: [ master ]
-
-jobs:
- build:
-
- runs-on: ubuntu-latest
-
- strategy:
- matrix:
- node-version: [14.x]
-
- steps:
- - uses: actions/checkout@v2
- - name: Check lint with eslint
- uses: actions/setup-node@v1
- with:
- node-version: ${{ matrix.node-version }}
- - run: yarn
- - run: yarn lint
diff --git a/.github/workflows/nodejs.demo.deploy.yml b/.github/workflows/nodejs.demo.deploy.yml
deleted file mode 100644
index 8a06f3dc..00000000
--- a/.github/workflows/nodejs.demo.deploy.yml
+++ /dev/null
@@ -1,44 +0,0 @@
-# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
-# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
-
-name: DEPLOY DEMO
-
-on:
- push:
- branches: [ master ]
-
-jobs:
- build:
-
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v2
- - name: Install SSH key
- uses: shimataro/ssh-key-action@v2
- with:
- key: ${{ secrets.SSH_DOCK_SERVER_PRIVATE_KEY }}
- name: id_rsa
- known_hosts: ${{ secrets.SSH_DOCK_SERVER_KNOWN_HOSTS }}
- - name: Prepare
- run: |
- cp .env.example .env
- sudo apt install -y pv
- ssh root@dok.8iq.dev 'id'
- env:
- SSH_PRIVATE_KEY: ${{ secrets.SSH_DOCK_SERVER_PRIVATE_KEY }}
- - name: Docker build
- run: |
- bash ./bin/warm-docker-cache
- docker-compose build
- - name: Upload builded image
- run: |
- ssh root@dok.8iq.dev "docker rmi apps:demo || echo no image"
- docker save apps:demo | bzip2 | pv | ssh root@dok.8iq.dev 'bunzip2 | docker load'
- - name: Restart demo app
- run: |
- export APP_VERSION=$GITHUB_SHA
- export APP=demo
- ssh root@dok.8iq.dev "docker tag apps:${APP} dokku/${APP}:${APP_VERSION}"
- ssh root@dok.8iq.dev "dokku tags:deploy ${APP} ${APP_VERSION}"
- ssh root@dok.8iq.dev "docker exec -i -u root ${APP}.web.1 yarn workspace @app/${APP} migrate"
diff --git a/.gitignore b/.gitignore
index 464f79bd..8a265303 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,22 +1,25 @@
-node_modules
-dist
-out
-.next
+# IDEs and editors
.idea
-.env
-.kmigrator
-.DS_Store
-.docker-cache-warming
-.expo
-.expo-shared
-web-build
-__generated__
-__media
-_example.js
+.project
+.classpath
+.c9
+*.launch
+.settings/
+*.sublime-workspace
+.vscode/*
+!.vscode/settings.json
+!.vscode/tasks.json
+!.vscode/launch.json
+!.vscode/extensions.json
# yarn + npm
+.yarn/*
+!.yarn/patches
+!.yarn/plugins
+!.yarn/releases
+!.yarn/sdks
+!.yarn/versions
yarn-error.log
-yarn.lock
npm-debug.*
# mobile
@@ -26,3 +29,59 @@ npm-debug.*
*.key
*.mobileprovision
*.orig.*
+
+# Swap the comments on the following lines if you wish to use zero-installs
+# In that case, don't forget to run `yarn config set enableGlobalCache false`!
+# Documentation here: https://yarnpkg.com/features/caching#zero-installs
+
+#!.yarn/cache
+.pnp.*
+
+# nx
+.nx/cache
+
+# System Files
+.DS_Store
+Thumbs.db
+*.pem
+
+# Dependencies
+node_modules
+
+# Local env files
+.env
+.env.local
+.env.development.local
+.env.test.local
+.env.production.local
+
+# Testing
+coverage
+
+# Build Outputs
+.turbo
+.next/
+out/
+build
+dist
+.next
+.kmigrator
+.expo
+.expo-shared
+.vercel
+web-build
+
+# Debug
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+
+# Misc
+/.sass-cache
+/connect.lock
+/libpeerconnection.log
+testem.log
+/typings
+__generated__
+__media
+_example.js
diff --git a/.yarn/install-state.gz b/.yarn/install-state.gz
new file mode 100644
index 00000000..025744ae
Binary files /dev/null and b/.yarn/install-state.gz differ
diff --git a/.yarnrc.yml b/.yarnrc.yml
new file mode 100644
index 00000000..3186f3f0
--- /dev/null
+++ b/.yarnrc.yml
@@ -0,0 +1 @@
+nodeLinker: node-modules
diff --git a/Dockerfile b/Dockerfile
index 48acb0ee..f0b13f15 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,17 +1,14 @@
-FROM buildpack-deps:buster AS base
+FROM buildpack-deps:bookworm AS base
# https://hub.docker.com/_/node
# https://github.com/nodejs/docker-node/blob/18ed56ea9ba03c16f48372927f5eb2553033e8de/14/buster/Dockerfile
# https://hub.docker.com/_/python
# https://github.com/docker-library/python/blob/f59139d685b3b39d4452a686521e03fa093efa25/3.8/buster/Dockerfile
-COPY --from=python:buster /usr/local/ /usr/local/
-COPY --from=node:buster /usr/local/ /usr/local/
-COPY --from=node:buster /opt/ /opt/
+COPY --from=python:3.12-bookworm /usr/local/ /usr/local/
+COPY --from=node:20-bookworm /usr/local/ /usr/local/
+COPY --from=node:20-bookworm /opt/ /opt/
# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8
-# Add app user/group! Clean packages and fix links! Check version! And install some extra packages!
-ARG DOCKER_FILE_INSTALL_COMMAND
-ENV DOCKER_FILE_INSTALL_COMMAND ${DOCKER_FILE_INSTALL_COMMAND}
RUN set -ex \
&& groupadd -r app --gid=999 \
&& useradd --system --create-home --home /home/app --gid 999 --uid=999 --shell /bin/bash app \
@@ -28,26 +25,35 @@ RUN set -ex \
&& node --version \
&& npm --version \
&& yarn --version \
- && bash -c "${DOCKER_FILE_INSTALL_COMMAND:?Build argument DOCKER_FILE_INSTALL_COMMAND needs to be set (check READEME.md)!}" \
&& echo "OK"
# Build container
FROM base AS build
-ARG DOCKER_FILE_BUILD_COMMAND
-ENV DOCKER_FILE_BUILD_COMMAND ${DOCKER_FILE_BUILD_COMMAND}
-USER app:app
WORKDIR /home/app
+
RUN echo "# Build time .env config!" >> /home/app/.env && \
echo "COOKIE_SECRET=undefined" >> /home/app/.env && \
echo "DATABASE_URL=undefined" >> /home/app/.env && \
echo "NODE_ENV=production" >> /home/app/.env
-# If you don't have this directory, you can create it by command `bash ./bin/warm-docker-cache` or just create empty ./.docker-cache-warming dir (no cache mode)
-ADD --chown=app:app ./.docker-cache-warming /home/app
+
+COPY package*.json ./
+COPY ./yarn.lock ./yarn.lock
+COPY ./.yarn ./.yarn
+COPY ./.yarnrc.yml ./.yarnrc.yml
+
# Cache packages!
-RUN set -ex && yarn install
+RUN set -ex \
+ && corepack enable \
+ && yarn set version stable \
+ && yarn install --immutable
+
ADD --chown=app:app . /home/app
-RUN set -ex && yarn && bash -c "${DOCKER_FILE_BUILD_COMMAND:?Build argument DOCKER_FILE_BUILD_COMMAND needs to be set (check READEME.md)!}" && \
- yarn cache clean && rm -rf /home/app/.env && rm -rf /home/app/.config && rm -rf /home/app/.yarn && rm -rf /home/app/.cache && \
+
+RUN set -ex && \
+ yarn build && \
+ rm -rf /home/app/.env && \
+ rm -rf /home/app/.config && \
+ rm -rf /home/app/.cache && \
ls -lah /home/app/
# Runtime container
diff --git a/README.md b/README.md
index cbf34360..d41d247a 100644
--- a/README.md
+++ b/README.md
@@ -4,57 +4,50 @@
# Rapid Development Node.js Hackathon template: [DEMO](https://demo.dok.8iq.dev/)
-This template based on [KeystoneJS](https://github.com/keystonejs/keystone) and [Next.js](https://github.com/vercel/next.js).
+This is [KeystoneJS](https://github.com/keystonejs/keystone) and [Next.js](https://github.com/vercel/next.js) base rapid development template.
+Which is time-based tested on the large project.
-We also use [Expo](https://github.com/expo/expo) for React based mobile app development.
-[Ant Design](https://github.com/ant-design/ant-design) as React Web UI kit and [UI Kitten](https://github.com/akveo/react-native-ui-kitten) as React Native UI kit
-
-KeystoneJS is just a glue between [Express](https://github.com/expressjs/express),
-[ApolloGraphql](https://github.com/apollographql/), Mongoose/Knex/Prisma (as ORM).
-
-Next.js is just a zero config React based framework.
+We use: Prisma, Apollo GraphQL
### Contents
-* [Motivation & Features](#why)
-* [Getting started](docs/getting-started.md)
-* [Deploy](docs/deploy.md)
-* [Contibuting](docs/contributing.md)
+- [Motivation & Features](#why)
+- [Getting started](docs/getting-started.md)
+- [Deploy](docs/deploy.md)
+- [Contributing](docs/contributing.md)
## Why?
-Javascript ecosystem is full of tutorials, open-source and helpful materials,
-but still, it's often **up to the developer** to implement such **basic** features like:
-* Authentication workflow (register-login-reset)
-* Permission mechanism
-* Import/Export
-* Logic reusability between web and mobile
-* And more
+When you start a new project, you need a time-tested approach to development.
+You need to prepare the basic structure of the project, implement registration and authorization.
+
+If you are making a B2B solution, you need to implement roles and access rights and the possibility of invites.
+
+You need to implement notifications, page templates, and internationalization support.
+
+Using a template, you don't have to spend hours choosing technologies and gluing them together.
-This project provides you with these basic features, allowing you to focus on core business logic
+The libraries used can be changed over time.
-Our primary focus is startup developers and hackaton teams
+Don't start by choosing a technology, start implement your key features!
+
+Our focus is to use the technologies that allow you to save your time and maximize your development experience.
+
+You can use this project if you are going to launch a new startup or participate in a hackathon.
## Features
-**VERSION**: 0.0.1 **𝛼**
-
-* Based on ApolloGraphql, KeystoneJS and NextJS
-* Auth flow
- * Registration
- * Authentication and Authorization
- * Change password
- * Reset password
-* Organization entity
- * Management of organization members
- * Invite users
- * Import users from excel
-* Ant design based frontend
-* A lot of examples — check /apps
-* Pluggable — use only what you need
-* Deployable — check [deploy.md](docs/deploy.md)
-
-Full list of features and requested features is found under [contibuting.md](docs/contributing.md) and issues
+- Auth flow
+ - Registration
+ - Authentication and Authorization
+ - Change password
+ - Reset password
+- Organization entity
+ - Management of organization members
+ - Invite users
+- Ant design based frontend
+
+Full list of features and requested features is found under [contributing.md](docs/contributing.md) and issues
## Getting started
@@ -63,7 +56,3 @@ Check [getting-started.md](docs/getting-started.md)
## Deploying
Check [deploy.md](docs/deploy.md)
-
-## Contributing
-
-Check [contributing.md](docs/contributing.md)
diff --git a/apps/README.md b/apps/README.md
new file mode 100644
index 00000000..a3ba5e96
--- /dev/null
+++ b/apps/README.md
@@ -0,0 +1,4 @@
+All applications are stored here.
+
+You can use a microservice approach or a traditional monolith approach.
+But we strongly recommend separating your API from the front-end application.
diff --git a/apps/_demo/README.md b/apps/_demo/README.md
deleted file mode 100644
index 8128186d..00000000
--- a/apps/_demo/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# demo #
-
-This project is deployed on demo.dok.8iq.dev!
-
-We use it for e2e purposes! Please don't use it as example!
diff --git a/apps/_demo/babel.config.js b/apps/_demo/babel.config.js
deleted file mode 100644
index f1dc37a3..00000000
--- a/apps/_demo/babel.config.js
+++ /dev/null
@@ -1,6 +0,0 @@
-module.exports = function (api) {
- api.cache(true)
- return {
- 'presets': ['next/babel'],
- }
-}
diff --git a/apps/_demo/e2e_tests/health.test.js b/apps/_demo/e2e_tests/health.test.js
deleted file mode 100644
index 443313ee..00000000
--- a/apps/_demo/e2e_tests/health.test.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * @jest-environment node
- */
-
-const conf = require('@core/config')
-const { setFakeClientMode } = require('@core/keystone/test.utils')
-if (conf.TESTS_FAKE_CLIENT_MODE) setFakeClientMode(require.resolve('../index'))
-
-const { gql } = require('@core/keystone/test.utils')
-const { makeClient } = require('@core/keystone/test.utils')
-
-const APP_VERSION_QUERY = gql`
- query {
- appVersion
- }
-`
-
-test('GQL API is healthy', async () => {
- const client = await makeClient()
- const { data } = await client.query(APP_VERSION_QUERY)
- expect(data).toEqual({ 'appVersion': '1.0.0' })
-})
diff --git a/apps/_demo/index.js b/apps/_demo/index.js
deleted file mode 100644
index f06250b1..00000000
--- a/apps/_demo/index.js
+++ /dev/null
@@ -1,74 +0,0 @@
-const { Keystone } = require('@keystonejs/keystone')
-const { PasswordAuthStrategy } = require('@keystonejs/auth-password')
-const { GraphQLApp } = require('@keystonejs/app-graphql')
-const { AdminUIApp } = require('@keystonejs/app-admin-ui')
-const { StaticApp } = require('@keystonejs/app-static')
-const { NextApp } = require('@keystonejs/app-next')
-const { createItems } = require('@keystonejs/server-side-graphql-client')
-
-const conf = require('@core/config')
-const access = require('@core/keystone/access')
-const { areWeRunningTests } = require('@core/keystone/test.utils')
-const { EmptyApp } = require('@core/keystone/test.utils')
-const { prepareDefaultKeystoneConfig } = require('@core/keystone/setup.utils')
-const { registerSchemas } = require('@core/keystone/schema')
-
-const keystone = new Keystone({
- ...prepareDefaultKeystoneConfig(conf),
- onConnect: async () => {
- // Initialise some data
- if (conf.NODE_ENV !== 'development') return // Just for dev env purposes!
- // This function can be called before tables are created! (we just ignore this)
- try {
- const users = await keystone.lists.User.adapter.findAll()
- if (!users.length) {
- const initialData = require('./initialData')
- for (let { listKey, items } of initialData) {
- console.log(`🗿 createItems(${listKey}) -> ${items.length}`)
- await createItems({
- keystone,
- listKey,
- items,
- })
- }
- }
- } catch (e) {
- console.warn('onConnectError:', e)
- }
- },
-})
-
-registerSchemas(keystone, [
- require('./schema/User'),
- require('./schema/Organization'),
- require('./schema/Auth'),
- require('./schema/Test'),
-])
-
-const authStrategy = keystone.createAuthStrategy({
- type: PasswordAuthStrategy,
- list: 'User',
-})
-
-module.exports = {
- configureExpress: app => {
- // The express application variable trust proxy must be set to support reverse proxying
- app.set('trust proxy', true)
- },
- keystone,
- apps: [
- new GraphQLApp({
- apollo: {
- debug: conf.NODE_ENV === 'development' || conf.NODE_ENV === 'test',
- },
- }),
- new StaticApp({ path: conf.MEDIA_URL, src: conf.MEDIA_ROOT }),
- new AdminUIApp({
- adminPath: '/admin',
- // enableDefaultRoute: true,
- isAccessAllowed: access.userIsAdmin,
- authStrategy,
- }),
- !areWeRunningTests() ? new NextApp({ dir: '.' }) : new EmptyApp(),
- ],
-}
diff --git a/apps/_demo/initialData.js b/apps/_demo/initialData.js
deleted file mode 100644
index 0d5c9670..00000000
--- a/apps/_demo/initialData.js
+++ /dev/null
@@ -1,33 +0,0 @@
-module.exports = [
- {
- listKey: 'User',
- items: [
- {
- data: {
- name: 'Admin',
- email: 'admin@example.com',
- isEmailVerified: false,
- phone: '89068888888',
- isPhoneVerified: false,
- isAdmin: true,
- isActive: true,
- dob: '1990-01-02',
- password: '3a74b3f07978',
- },
- },
- {
- data: {
- name: 'JustUser',
- email: 'user@example.com',
- isEmailVerified: false,
- phone: '89068888811',
- isPhoneVerified: false,
- isAdmin: false,
- isActive: true,
- dob: '1995-06-09',
- password: '1a92b3a07c78',
- },
- },
- ],
- },
-]
diff --git a/apps/_demo/jest.config.js b/apps/_demo/jest.config.js
deleted file mode 100644
index 73f32e50..00000000
--- a/apps/_demo/jest.config.js
+++ /dev/null
@@ -1,20 +0,0 @@
-module.exports = {
- testURL: 'http://localhost:3000/',
- collectCoverageFrom: [
- '**/*.{js,jsx,ts,tsx}',
- '!**/*.d.ts',
- '!**/node_modules/**',
- // '!**/.next/**',
- ],
- setupFilesAfterEnv: [`${__dirname}/jest.setup.js`],
- testPathIgnorePatterns: ['/node_modules/', '/.next/'],
- transform: {
- '^.+\\.(js|jsx|ts|tsx)$': 'babel-jest',
- },
- // moduleNameMapper: {
- // '^(@core)/(.*?)/(.*?)$': `${__dirname}/../../packages/$1.$2/$3`
- // },
- transformIgnorePatterns: [
- 'node_modules', '.next',
- ],
-}
diff --git a/apps/_demo/jest.setup.js b/apps/_demo/jest.setup.js
deleted file mode 100644
index 66767983..00000000
--- a/apps/_demo/jest.setup.js
+++ /dev/null
@@ -1,5 +0,0 @@
-// optional: configure or set up a testing framework before each test
-// if you delete this file, remove `setupFilesAfterEnv` from `jest.config.js`
-// used for __tests__/testing-library.js
-// learn more: https://github.com/testing-library/jest-dom
-import '@testing-library/jest-dom/extend-expect'
diff --git a/apps/_demo/lang/en.json b/apps/_demo/lang/en.json
deleted file mode 100644
index e5951041..00000000
--- a/apps/_demo/lang/en.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "pages.index.PageTitle": "demo",
- "menu.Home": "Dashboard",
- "menu.Users": "Users",
- "WeAreStillDevelopingThisPage": "We are still **developing** this page, it is not **yet** available"
-}
diff --git a/apps/_demo/lang/ru.json b/apps/_demo/lang/ru.json
deleted file mode 100644
index ae71b53e..00000000
--- a/apps/_demo/lang/ru.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "pages.index.PageTitle": "Демо",
- "menu.Home": "Дашборд",
- "menu.Users": "Пользователи",
- "WeAreStillDevelopingThisPage": "Мы еще **разрабатываем** эту страницу, она пока недоступна"
-}
diff --git a/apps/_demo/migrations/20200529191915-0001_initial.js b/apps/_demo/migrations/20200529191915-0001_initial.js
deleted file mode 100644
index 8dc0d54c..00000000
--- a/apps/_demo/migrations/20200529191915-0001_initial.js
+++ /dev/null
@@ -1,89 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0001_initial:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMC42IG9uIDIwMjAtMDUtMjkgMTQ6MTkKCmltcG9ydCBkamFuZ28uY29udHJpYi5wb3N0Z3Jlcy5maWVsZHMuanNvbmIKZnJvbSBkamFuZ28uZGIgaW1wb3J0IG1pZ3JhdGlvbnMsIG1vZGVscwppbXBvcnQgZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbgoKCmNsYXNzIE1pZ3JhdGlvbihtaWdyYXRpb25zLk1pZ3JhdGlvbik6CgogICAgaW5pdGlhbCA9IFRydWUKCiAgICBkZXBlbmRlbmNpZXMgPSBbCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkNyZWF0ZU1vZGVsKAogICAgICAgICAgICBuYW1lPSd0ZXN0JywKICAgICAg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MuVGV4dEZpZWxkKHVuaXF1ZT1UcnVlKSksCiAgICAgICAgICAgICAgICAoJ3NlbGYnLCBtb2RlbHMuRm9yZWlnbktleShibGFuaz1UcnVlLCBkYl9jb2x1bW49J3NlbGYnLCBudWxsPVRydWUsIG9uX2RlbGV0ZT1kamFuZ28uZGIubW9kZWxzLmRlbGV0aW9uLkRPX05PVEhJTkcsIHJlbGF0ZWRfbmFtZT0nKycsIHRvPSdfZGphbmdvX3NjaGVtYS50ZXN0JykpLAogICAgICAgICAgICBdLAogICAgICAgICAgICBvcHRpb25zPXsKICAgICAgICAgICAgICAgICdkYl90YWJsZSc6ICdUZXN0JywKICAgICAgICAgICAgfSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQ3JlYXRlTW9kZWwoCiAgICAgICAgICAgIG5hbWU9J3VzZXInLAogICAgICAgICAgICBmaWVsZHM9WwogICAgICAgICAgICAgICAgKCdpZCcsIG1vZGVscy5BdXRvRmllbGQocHJpbWFyeV9rZXk9VHJ1ZSwgc2VyaWFsaXplPUZhbHNlKSksCiAgICAgICAgICAgICAgICAoJ25hbWUnLCBtb2RlbHMuVGV4dEZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCdlbWFpbCcsIG1vZGVscy5UZXh0RmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlLCB1bmlxdWU9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCdpc0FkbWluJywgbW9kZWxzLkJvb2xlYW5GaWVsZCgpKSwKICAgICAgICAgICAgICAgICgnaXNBY3RpdmUnLCBtb2RlbHMuQm9vbGVhbkZpZWxkKCkpLAogICAgICAgICAgICAgICAgKCdwYXNzd29yZCcsIG1vZGVscy5DaGFyRmllbGQoYmxhbms9VHJ1ZSwgbWF4X2xlbmd0aD02MCwgbnVsbD1UcnVlKSksCiAgICAgICAgICAgICAgICAoJ2F2YXRhcicsIGRqYW5nby5jb250cmliLnBvc3RncmV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1hLnVzZXInKSksCiAgICAgICAgICAgICAgICAoJ3VwZGF0ZWRCeScsIG1vZGVscy5Gb3JlaWduS2V5KGJsYW5rPVRydWUsIGRiX2NvbHVtbj0ndXBkYXRlZEJ5JywgbnVsbD1UcnVlLCBvbl9kZWxldGU9ZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbi5ET19OT1RISU5HLCByZWxhdGVkX25hbWU9JysnLCB0bz0nX2RqYW5nb19zY2hlbWEudXNlcicpKSwKICAgICAgICAgICAgXSwKICAgICAgICAgICAgb3B0aW9ucz17CiAgICAgICAgICAgICAgICAnZGJfdGFibGUnOiAnVXNlcicsCiAgICAgICAgICAgIH0sCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkNyZWF0ZU1vZGVsKAogICAgICAgICAgICBuYW1lPSd0b2RvJywKICAgICAgICAgICAgZmllbGRzPVsKICAgICAgICAgICAgICAgICgnaWQnLCBtb2RlbHMuQXV0b0ZpZWxkKHByaW1hcnlfa2V5PVRydWUsIHNlcmlhbGl6ZT1GYWxzZSkpLAogICAgICAgICAgICAgICAgKCdkZXNjcmlwdGlvbicsIG1vZGVscy5UZXh0RmllbGQoKSksCiAgICAgICAgICAgICAgICAoJ2lzQ29tcGxldGUnLCBtb2RlbHMuQm9vbGVhbkZpZWxkKCkpLAogICAgICAgICAgICAgICAgKCdkZWFkbGluZScsIG1vZGVscy5EYXRlRmllbGQoKSksCiAgICAgICAgICAgICAgICAoJ3N0YXJzJywgbW9kZWxzLkludGVnZXJGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgnYXNzaWduZWUnLCBtb2RlbHMuRm9yZWlnbktleShibGFuaz1UcnVlLCBkYl9jb2x1bW49J2Fzc2lnbmVlJywgbnVsbD1UcnVlLCBvbl9kZWxldGU9ZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbi5ET19OT1RISU5HLCByZWxhdGVkX25hbWU9JysnLCB0bz0nX2RqYW5nb19zY2hlbWEudXNlcicpKSwKICAgICAgICAgICAgXSwKICAgICAgICAgICAgb3B0aW9ucz17CiAgICAgICAgICAgICAgICAnZGJfdGFibGUnOiAnVG9kbycsCiAgICAgICAgICAgIH0sCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkNyZWF0ZU1vZGVsKAogICAgICAgICAgICBuYW1lPSd0ZXN0X3VzZXJzX21hbnknLAogICAgICAgICAgICBmaWVsZHM9WwogICAgICAgICAgICAgICAgKCdpZCcsIG1vZGVscy5BdXRvRmllbGQoYXV0b19jcmVhdGVkPVRydWUsIHByaW1hcnlfa2V5PVRydWUsIHNlcmlhbGl6ZT1GYWxzZSwgdmVyYm9zZV9uYW1lPSdJRCcpKSwKICAgICAgICAgICAgICAgICgnVGVzdF9sZWZ0X2lkJywgbW9kZWxzLkZvcmVpZ25LZXkoZGJfY29sdW1uPSdUZXN0X2xlZnRfaWQnLCBvbl9kZWxldGU9ZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbi5DQVNDQURFLCByZWxhdGVkX25hbWU9JysnLCB0bz0nX2RqYW5nb19zY2hlbWEudGVzdCcpKSwKICAgICAgICAgICAgICAgICgnVXNlcl9yaWdodF9pZCcsIG1vZGVscy5Gb3JlaWduS2V5KGRiX2NvbHVtbj0nVXNlcl9yaWdodF9pZCcsIG9uX2RlbGV0ZT1kamFuZ28uZGIubW9kZWxzLmRlbGV0aW9uLkNBU0NBREUsIHJlbGF0ZWRfbmFtZT0nKycsIHRvPSdfZGphbmdvX3NjaGVtYS51c2VyJykpLAogICAgICAgICAgICBdLAogICAgICAgICAgICBvcHRpb25zPXsKICAgICAgICAgICAgICAgICdkYl90YWJsZSc6ICdUZXN0X3VzZXJzX21hbnknLAogICAgICAgICAgICB9LAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5DcmVhdGVNb2RlbCgKICAgICAgICAgICAgbmFtZT0nZm9yZ290cGFzc3dvcmRhY3Rpb24nLAogICAgICAgICAgICBmaWVsZHM9WwogICAgICAgICAgICAgICAgKCdpZCcsIG1vZGVscy5BdXRvRmllbGQocHJpbWFyeV9rZXk9VHJ1ZSwgc2VyaWFsaXplPUZhbHNlKSksCiAgICAgICAgICAgICAgICAoJ3Rva2VuJywgbW9kZWxzLlRleHRGaWVsZCh1bmlxdWU9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCdyZXF1ZXN0ZWRBdF91dGMnLCBtb2RlbHMuRGF0ZVRpbWVGaWVsZCgpKSwKICAgICAgICAgICAgICAgICgncmVxdWVzdGVkQXRfb2Zmc2V0JywgbW9kZWxzLlRleHRGaWVsZCgpKSwKICAgICAgICAgICAgICAgICgnZXhwaXJlc0F0X3V0YycsIG1vZGVscy5EYXRlVGltZUZpZWxkKCkpLAogICAgICAgICAgICAgICAgKCdleHBpcmVzQXRfb2Zmc2V0JywgbW9kZWxzLlRleHRGaWVsZCgpKSwKICAgICAgICAgICAgICAgICgndXNlZEF0X3V0YycsIG1vZGVscy5EYXRlVGltZUZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCd1c2VkQXRfb2Zmc2V0JywgbW9kZWxzLlRleHRGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgndXBkYXRlZEF0X3V0YycsIG1vZGVscy5EYXRlVGltZUZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCd1cGRhdGVkQXRfb2Zmc2V0JywgbW9kZWxzLlRleHRGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgnY3JlYXRlZEF0X3V0YycsIG1vZGVscy5EYXRlVGltZUZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCdjcmVhdGVkQXRfb2Zmc2V0JywgbW9kZWxzLlRleHRGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgnY3JlYXRlZEJ5JywgbW9kZWxzLkZvcmVpZ25LZXkoYmxhbms9VHJ1ZSwgZGJfY29sdW1uPSdjcmVhdGVkQnknLCBudWxsPVRydWUsIG9uX2RlbGV0ZT1kamFuZ28uZGIubW9kZWxzLmRlbGV0aW9uLkRPX05PVEhJTkcsIHJlbGF0ZWRfbmFtZT0nKycsIHRvPSdfZGphbmdvX3NjaGVtYS51c2VyJykpLAogICAgICAgICAgICAgICAgKCd1cGRhdGVkQnknLCBtb2RlbHMuRm9yZWlnbktleShibGFuaz1UcnVlLCBkYl9jb2x1bW49J3VwZGF0ZWRCeScsIG51bGw9VHJ1ZSwgb25fZGVsZXRlPWRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24uRE9fTk9USElORywgcmVsYXRlZF9uYW1lPScrJywgdG89J19kamFuZ29fc2NoZW1hLnVzZXInKSksCiAgICAgICAgICAgICAgICAoJ3VzZXInLCBtb2RlbHMuRm9yZWlnbktleShibGFuaz1UcnVlLCBkYl9jb2x1bW49J3VzZXInLCBudWxsPVRydWUsIG9uX2RlbGV0ZT1kamFuZ28uZGIubW9kZWxzLmRlbGV0aW9uLkRPX05PVEhJTkcsIHJlbGF0ZWRfbmFtZT0nKycsIHRvPSdfZGphbmdvX3NjaGVtYS51c2VyJykpLAogICAgICAgICAgICBdLAogICAgICAgICAgICBvcHRpb25zPXsKICAgICAgICAgICAgICAgICdkYl90YWJsZSc6ICdGb3Jnb3RQYXNzd29yZEFjdGlvbicsCiAgICAgICAgICAgIH0sCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkNyZWF0ZU1vZGVsKAogICAgICAgICAgICBuYW1lPSdjb250ZW50dHlwZV90ZXN0X2JvZHknLAogICAgICAgICAgICBmaWVsZHM9WwogICAgICAgICAgICAgICAgKCdpZCcsIG1vZGVscy5BdXRvRmllbGQocHJpbWFyeV9rZXk9VHJ1ZSwgc2VyaWFsaXplPUZhbHNlKSksCiAgICAgICAgICAgICAgICAoJ2RvY3VtZW50JywgbW9kZWxzLlRleHRGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgnZnJvbV9maWVsZCcsIG1vZGVscy5Gb3JlaWduS2V5KGJsYW5rPVRydWUsIGRiX2NvbHVtbj0nZnJvbScsIG51bGw9VHJ1ZSwgb25fZGVsZXRlPWRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24uRE9fTk9USElORywgcmVsYXRlZF9uYW1lPScrJywgdG89J19kamFuZ29fc2NoZW1hLnRlc3QnKSksCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgIG9wdGlvbnM9ewogICAgICAgICAgICAgICAgJ2RiX3RhYmxlJzogJ19Db250ZW50VHlwZV9UZXN0X2JvZHknLAogICAgICAgICAgICB9LAogICAgICAgICksCiAgICBdCg==
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Create model test
---
-CREATE TABLE "Test" ("id" serial NOT NULL PRIMARY KEY, "heroColor" text NULL, "isEnabled" boolean NOT NULL, "rating1" integer NULL, "rating2" numeric(8, 2) NULL, "rating3" numeric(18, 4) NULL, "venue" jsonb NULL, "status" varchar(50) NOT NULL, "uuid" uuid NOT NULL, "url" text NOT NULL, "slug" text NOT NULL UNIQUE, "self" integer NULL);
---
--- Create model user
---
-CREATE TABLE "User" ("id" serial NOT NULL PRIMARY KEY, "name" text NULL, "email" text NULL UNIQUE, "isAdmin" boolean NOT NULL DEFAULT false, "isActive" boolean NOT NULL, "password" varchar(60) NULL, "avatar" jsonb NULL, "dob" date NULL, "rating" integer NULL, "settings" text NULL, "aboutMyself" text NULL, "updatedAt_utc" timestamp with time zone NULL, "updatedAt_offset" text NULL, "createdAt_utc" timestamp with time zone NULL, "createdAt_offset" text NULL, "createdBy" integer NULL, "updatedBy" integer NULL);
---
--- Create model todo
---
-CREATE TABLE "Todo" ("id" serial NOT NULL PRIMARY KEY, "description" text NOT NULL, "isComplete" boolean NOT NULL, "deadline" date NOT NULL, "stars" integer NULL, "assignee" integer NULL);
---
--- Create model test_users_many
---
-CREATE TABLE "Test_users_many" ("id" serial NOT NULL PRIMARY KEY, "Test_left_id" integer NOT NULL, "User_right_id" integer NOT NULL);
---
--- Create model forgotpasswordaction
---
-CREATE TABLE "ForgotPasswordAction" ("id" serial NOT NULL PRIMARY KEY, "token" text NOT NULL UNIQUE, "requestedAt_utc" timestamp with time zone NOT NULL, "requestedAt_offset" text NOT NULL, "expiresAt_utc" timestamp with time zone NOT NULL, "expiresAt_offset" text NOT NULL, "usedAt_utc" timestamp with time zone NULL, "usedAt_offset" text NULL, "updatedAt_utc" timestamp with time zone NULL, "updatedAt_offset" text NULL, "createdAt_utc" timestamp with time zone NULL, "createdAt_offset" text NULL, "createdBy" integer NULL, "updatedBy" integer NULL, "user" integer NULL);
---
--- Create model contenttype_test_body
---
-CREATE TABLE "_ContentType_Test_body" ("id" serial NOT NULL PRIMARY KEY, "document" text NULL, "from" integer NULL);
-ALTER TABLE "Test" ADD CONSTRAINT "Test_self_d23d7ad7_fk_Test_id" FOREIGN KEY ("self") REFERENCES "Test" ("id") DEFERRABLE INITIALLY DEFERRED;
-CREATE INDEX "Test_slug_b8eaf23d_like" ON "Test" ("slug" text_pattern_ops);
-CREATE INDEX "Test_self_d23d7ad7" ON "Test" ("self");
-ALTER TABLE "User" ADD CONSTRAINT "User_createdBy_7f87595a_fk_User_id" FOREIGN KEY ("createdBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "User" ADD CONSTRAINT "User_updatedBy_998aac8b_fk_User_id" FOREIGN KEY ("updatedBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-CREATE INDEX "User_email_667201b5_like" ON "User" ("email" text_pattern_ops);
-CREATE INDEX "User_createdBy_7f87595a" ON "User" ("createdBy");
-CREATE INDEX "User_updatedBy_998aac8b" ON "User" ("updatedBy");
-ALTER TABLE "Todo" ADD CONSTRAINT "Todo_assignee_c94c59ce_fk_User_id" FOREIGN KEY ("assignee") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-CREATE INDEX "Todo_assignee_c94c59ce" ON "Todo" ("assignee");
-ALTER TABLE "Test_users_many" ADD CONSTRAINT "Test_users_many_Test_left_id_f75fcc4b_fk_Test_id" FOREIGN KEY ("Test_left_id") REFERENCES "Test" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "Test_users_many" ADD CONSTRAINT "Test_users_many_User_right_id_967e69d4_fk_User_id" FOREIGN KEY ("User_right_id") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-CREATE INDEX "Test_users_many_Test_left_id_f75fcc4b" ON "Test_users_many" ("Test_left_id");
-CREATE INDEX "Test_users_many_User_right_id_967e69d4" ON "Test_users_many" ("User_right_id");
-ALTER TABLE "ForgotPasswordAction" ADD CONSTRAINT "ForgotPasswordAction_createdBy_c0278297_fk_User_id" FOREIGN KEY ("createdBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "ForgotPasswordAction" ADD CONSTRAINT "ForgotPasswordAction_updatedBy_60e6cb54_fk_User_id" FOREIGN KEY ("updatedBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "ForgotPasswordAction" ADD CONSTRAINT "ForgotPasswordAction_user_3c52ec86_fk_User_id" FOREIGN KEY ("user") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-CREATE INDEX "ForgotPasswordAction_token_9a0cc9b4_like" ON "ForgotPasswordAction" ("token" text_pattern_ops);
-CREATE INDEX "ForgotPasswordAction_createdBy_c0278297" ON "ForgotPasswordAction" ("createdBy");
-CREATE INDEX "ForgotPasswordAction_updatedBy_60e6cb54" ON "ForgotPasswordAction" ("updatedBy");
-CREATE INDEX "ForgotPasswordAction_user_3c52ec86" ON "ForgotPasswordAction" ("user");
-ALTER TABLE "_ContentType_Test_body" ADD CONSTRAINT "_ContentType_Test_body_from_db1ad4fe_fk_Test_id" FOREIGN KEY ("from") REFERENCES "Test" ("id") DEFERRABLE INITIALLY DEFERRED;
-CREATE INDEX "_ContentType_Test_body_from_db1ad4fe" ON "_ContentType_Test_body" ("from");
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Create model contenttype_test_body
---
-DROP TABLE "_ContentType_Test_body" CASCADE;
---
--- Create model forgotpasswordaction
---
-DROP TABLE "ForgotPasswordAction" CASCADE;
---
--- Create model test_users_many
---
-DROP TABLE "Test_users_many" CASCADE;
---
--- Create model todo
---
-DROP TABLE "Todo" CASCADE;
---
--- Create model user
---
-DROP TABLE "User" CASCADE;
---
--- Create model test
---
-DROP TABLE "Test" CASCADE;
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20200529191932-0002_chatmessage_condo_condo_users_many.js b/apps/_demo/migrations/20200529191932-0002_chatmessage_condo_condo_users_many.js
deleted file mode 100644
index 96b7f28b..00000000
--- a/apps/_demo/migrations/20200529191932-0002_chatmessage_condo_condo_users_many.js
+++ /dev/null
@@ -1,50 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0002_chatmessage_condo_condo_users_many:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMC42IG9uIDIwMjAtMDUtMjkgMTQ6MTkKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKaW1wb3J0IGRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24KCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMDFfaW5pdGlhbCcpLAogICAgXQoKICAgIG9wZXJhdGlvbnMgPSBbCiAgICAgICAgbWlncmF0aW9ucy5DcmVhdGVNb2RlbCgKICAgICAgICAgICAgbmFtZT0nY29uZG8nLAogICAgICAgICAgICBmaWVsZHM9WwogICAgICAgICAgICAgICAgKCdpZCcsIG1vZGVscy5BdXRvRmllbGQocHJpbWFyeV9rZXk9VHJ1ZSwgc2VyaWFsaXplPUZhbHNlKSksCiAgICAgICAgICAgICAgICAoJ2FkZHJlc3MnLCBtb2RlbHMuVGV4dEZpZWxkKCkpLAogICAgICAgICAgICBdLAogICAgICAgICAgICBvcHRpb25zPXsKICAgICAgICAgICAgICAgICdkYl90YWJsZSc6ICdDb25kbycsCiAgICAgICAgICAgIH0sCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkNyZWF0ZU1vZGVsKAogICAgICAgICAgICBuYW1lPSdjb25kb191c2Vyc19tYW55JywKICAgICAgICAgICAgZmllbGRzPVsKICAgICAgICAgICAgICAgICgnaWQnLCBtb2RlbHMuQXV0b0ZpZWxkKGF1dG9fY3JlYXRlZD1UcnVlLCBwcmltYXJ5X2tleT1UcnVlLCBzZXJpYWxpemU9RmFsc2UsIHZlcmJvc2VfbmFtZT0nSUQnKSksCiAgICAgICAgICAgICAgICAoJ0NvbmRvX2xlZnRfaWQnLCBtb2RlbHMuRm9yZWlnbktleShkYl9jb2x1bW49J0NvbmRvX2xlZnRfaWQnLCBvbl9kZWxldGU9ZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbi5DQVNDQURFLCByZWxhdGVkX25hbWU9JysnLCB0bz0nX2RqYW5nb19zY2hlbWEuY29uZG8nKSksCiAgICAgICAgICAgICAgICAoJ1VzZXJfcmlnaHRfaWQnLCBtb2RlbHMuRm9yZWlnbktleShkYl9jb2x1bW49J1VzZXJfcmlnaHRfaWQnLCBvbl9kZWxldGU9ZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbi5DQVNDQURFLCByZWxhdGVkX25hbWU9JysnLCB0bz0nX2RqYW5nb19zY2hlbWEudXNlcicpKSwKICAgICAgICAgICAgXSwKICAgICAgICAgICAgb3B0aW9ucz17CiAgICAgICAgICAgICAgICAnZGJfdGFibGUnOiAnQ29uZG9fdXNlcnNfbWFueScsCiAgICAgICAgICAgIH0sCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkNyZWF0ZU1vZGVsKAogICAgICAgICAgICBuYW1lPSdjaGF0bWVzc2FnZScsCiAgICAgICAgICAgIGZpZWxkcz1bCiAgICAgICAgICAgICAgICAoJ2lkJywgbW9kZWxzLkF1dG9GaWVsZChwcmltYXJ5X2tleT1UcnVlLCBzZXJpYWxpemU9RmFsc2UpKSwKICAgICAgICAgICAgICAgICgnbWVzc2FnZScsIG1vZGVscy5UZXh0RmllbGQoKSksCiAgICAgICAgICAgICAgICAoJ2NoYXQnLCBtb2RlbHMuRm9yZWlnbktleShibGFuaz1UcnVlLCBkYl9jb2x1bW49J2NoYXQnLCBudWxsPVRydWUsIG9uX2RlbGV0ZT1kamFuZ28uZGIubW9kZWxzLmRlbGV0aW9uLkRPX05PVEhJTkcsIHJlbGF0ZWRfbmFtZT0nKycsIHRvPSdfZGphbmdvX3NjaGVtYS5jb25kbycpKSwKICAgICAgICAgICAgICAgICgndXNlcicsIG1vZGVscy5Gb3JlaWduS2V5KGJsYW5rPVRydWUsIGRiX2NvbHVtbj0ndXNlcicsIG51bGw9VHJ1ZSwgb25fZGVsZXRlPWRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24uRE9fTk9USElORywgcmVsYXRlZF9uYW1lPScrJywgdG89J19kamFuZ29fc2NoZW1hLnVzZXInKSksCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgIG9wdGlvbnM9ewogICAgICAgICAgICAgICAgJ2RiX3RhYmxlJzogJ0NoYXRNZXNzYWdlJywKICAgICAgICAgICAgfSwKICAgICAgICApLAogICAgXQo=
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Create model condo
---
-CREATE TABLE "Condo" ("id" serial NOT NULL PRIMARY KEY, "address" text NOT NULL);
---
--- Create model condo_users_many
---
-CREATE TABLE "Condo_users_many" ("id" serial NOT NULL PRIMARY KEY, "Condo_left_id" integer NOT NULL, "User_right_id" integer NOT NULL);
---
--- Create model chatmessage
---
-CREATE TABLE "ChatMessage" ("id" serial NOT NULL PRIMARY KEY, "message" text NOT NULL, "chat" integer NULL, "user" integer NULL);
-ALTER TABLE "Condo_users_many" ADD CONSTRAINT "Condo_users_many_Condo_left_id_5d8a37ce_fk_Condo_id" FOREIGN KEY ("Condo_left_id") REFERENCES "Condo" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "Condo_users_many" ADD CONSTRAINT "Condo_users_many_User_right_id_11f477e6_fk_User_id" FOREIGN KEY ("User_right_id") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-CREATE INDEX "Condo_users_many_Condo_left_id_5d8a37ce" ON "Condo_users_many" ("Condo_left_id");
-CREATE INDEX "Condo_users_many_User_right_id_11f477e6" ON "Condo_users_many" ("User_right_id");
-ALTER TABLE "ChatMessage" ADD CONSTRAINT "ChatMessage_chat_e0539e32_fk_Condo_id" FOREIGN KEY ("chat") REFERENCES "Condo" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "ChatMessage" ADD CONSTRAINT "ChatMessage_user_f76717e7_fk_User_id" FOREIGN KEY ("user") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-CREATE INDEX "ChatMessage_chat_e0539e32" ON "ChatMessage" ("chat");
-CREATE INDEX "ChatMessage_user_f76717e7" ON "ChatMessage" ("user");
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Create model chatmessage
---
-DROP TABLE "ChatMessage" CASCADE;
---
--- Create model condo_users_many
---
-DROP TABLE "Condo_users_many" CASCADE;
---
--- Create model condo
---
-DROP TABLE "Condo" CASCADE;
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20200530002440-0003_auto_20200529_1924.js b/apps/_demo/migrations/20200530002440-0003_auto_20200529_1924.js
deleted file mode 100644
index 47e122db..00000000
--- a/apps/_demo/migrations/20200530002440-0003_auto_20200529_1924.js
+++ /dev/null
@@ -1,50 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0003_auto_20200529_1924:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMC42IG9uIDIwMjAtMDUtMjkgMTk6MjQKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zCgoKY2xhc3MgTWlncmF0aW9uKG1pZ3JhdGlvbnMuTWlncmF0aW9uKToKCiAgICBkZXBlbmRlbmNpZXMgPSBbCiAgICAgICAgKCdfZGphbmdvX3NjaGVtYScsICcwMDAyX2NoYXRtZXNzYWdlX2NvbmRvX2NvbmRvX3VzZXJzX21hbnknKSwKICAgIF0KCiAgICBvcGVyYXRpb25zID0gWwojICAgICAgICBtaWdyYXRpb25zLlJlbW92ZUZpZWxkKAojICAgICAgICAgICAgbW9kZWxfbmFtZT0nY2hhdG1lc3NhZ2UnLAojICAgICAgICAgICAgbmFtZT0nY2hhdCcsCiMgICAgICAgICksCiMgICAgICAgIG1pZ3JhdGlvbnMuUmVtb3ZlRmllbGQoCiMgICAgICAgICAgICBtb2RlbF9uYW1lPSdjaGF0bWVzc2FnZScsCiMgICAgICAgICAgICBuYW1lPSd1c2VyJywKIyAgICAgICAgKSwKIyAgICAgICAgbWlncmF0aW9ucy5SZW1vdmVGaWVsZCgKIyAgICAgICAgICAgIG1vZGVsX25hbWU9J2NvbmRvX3VzZXJzX21hbnknLAojICAgICAgICAgICAgbmFtZT0nQ29uZG9fbGVmdF9pZCcsCiMgICAgICAgICksCiMgICAgICAgIG1pZ3JhdGlvbnMuUmVtb3ZlRmllbGQoCiMgICAgICAgICAgICBtb2RlbF9uYW1lPSdjb25kb191c2Vyc19tYW55JywKIyAgICAgICAgICAgIG5hbWU9J1VzZXJfcmlnaHRfaWQnLAojICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuRGVsZXRlTW9kZWwoCiAgICAgICAgICAgIG5hbWU9J2NvbmRvX3VzZXJzX21hbnknLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5EZWxldGVNb2RlbCgKICAgICAgICAgICAgbmFtZT0nY2hhdG1lc3NhZ2UnLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5EZWxldGVNb2RlbCgKICAgICAgICAgICAgbmFtZT0nY29uZG8nLAogICAgICAgICksCiAgICBdCg==
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Delete model condo_users_many
---
-DROP TABLE "Condo_users_many" CASCADE;
---
--- Delete model chatmessage
---
-DROP TABLE "ChatMessage" CASCADE;
---
--- Delete model condo
---
-DROP TABLE "Condo" CASCADE;
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Delete model condo
---
-CREATE TABLE "Condo" ("id" serial NOT NULL PRIMARY KEY, "address" text NOT NULL);
---
--- Delete model chatmessage
---
-CREATE TABLE "ChatMessage" ("id" serial NOT NULL PRIMARY KEY, "message" text NOT NULL, "chat" integer NULL, "user" integer NULL);
---
--- Delete model condo_users_many
---
-CREATE TABLE "Condo_users_many" ("id" serial NOT NULL PRIMARY KEY, "Condo_left_id" integer NOT NULL, "User_right_id" integer NOT NULL);
-ALTER TABLE "ChatMessage" ADD CONSTRAINT "ChatMessage_chat_e0539e32_fk_Condo_id" FOREIGN KEY ("chat") REFERENCES "Condo" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "ChatMessage" ADD CONSTRAINT "ChatMessage_user_f76717e7_fk_User_id" FOREIGN KEY ("user") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-CREATE INDEX "ChatMessage_chat_e0539e32" ON "ChatMessage" ("chat");
-CREATE INDEX "ChatMessage_user_f76717e7" ON "ChatMessage" ("user");
-ALTER TABLE "Condo_users_many" ADD CONSTRAINT "Condo_users_many_Condo_left_id_5d8a37ce_fk_Condo_id" FOREIGN KEY ("Condo_left_id") REFERENCES "Condo" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "Condo_users_many" ADD CONSTRAINT "Condo_users_many_User_right_id_11f477e6_fk_User_id" FOREIGN KEY ("User_right_id") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-CREATE INDEX "Condo_users_many_Condo_left_id_5d8a37ce" ON "Condo_users_many" ("Condo_left_id");
-CREATE INDEX "Condo_users_many_User_right_id_11f477e6" ON "Condo_users_many" ("User_right_id");
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20200530002952-0004_auto_20200529_1929.js b/apps/_demo/migrations/20200530002952-0004_auto_20200529_1929.js
deleted file mode 100644
index 2cbe5cfb..00000000
--- a/apps/_demo/migrations/20200530002952-0004_auto_20200529_1929.js
+++ /dev/null
@@ -1,26 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0004_auto_20200529_1929:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMC42IG9uIDIwMjAtMDUtMjkgMTk6MjkKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zCgoKY2xhc3MgTWlncmF0aW9uKG1pZ3JhdGlvbnMuTWlncmF0aW9uKToKCiAgICBkZXBlbmRlbmNpZXMgPSBbCiAgICAgICAgKCdfZGphbmdvX3NjaGVtYScsICcwMDAzX2F1dG9fMjAyMDA1MjlfMTkyNCcpLAogICAgXQoKICAgIG9wZXJhdGlvbnMgPSBbCiAgICAgICAgbWlncmF0aW9ucy5SZW5hbWVGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdCcsCiAgICAgICAgICAgIG9sZF9uYW1lPSdzdGF0dXMnLAogICAgICAgICAgICBuZXdfbmFtZT0nc3RhdHVzX3JlbmFtZWQnLAogICAgICAgICksCiAgICBdCg==
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Rename field status on test to status_renamed
---
-ALTER TABLE "Test" RENAME COLUMN "status" TO "status_renamed";
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Rename field status on test to status_renamed
---
-ALTER TABLE "Test" RENAME COLUMN "status_renamed" TO "status";
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20200530003042-0005_auto_20200529_1930.js b/apps/_demo/migrations/20200530003042-0005_auto_20200529_1930.js
deleted file mode 100644
index b0df580c..00000000
--- a/apps/_demo/migrations/20200530003042-0005_auto_20200529_1930.js
+++ /dev/null
@@ -1,29 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0005_auto_20200529_1930:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMC42IG9uIDIwMjAtMDUtMjkgMTk6MzAKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMDRfYXV0b18yMDIwMDUyOV8xOTI5JyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3QnLAogICAgICAgICAgICBuYW1lPSdyYXRpbmcxJywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLkludGVnZXJGaWVsZChkZWZhdWx0PTIyKSwKICAgICAgICAgICAgcHJlc2VydmVfZGVmYXVsdD1GYWxzZSwKICAgICAgICApLAogICAgXQo=
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Alter field rating1 on test
---
-ALTER TABLE "Test" ALTER COLUMN "rating1" SET DEFAULT 22;
-UPDATE "Test" SET "rating1" = 22 WHERE "rating1" IS NULL;
-ALTER TABLE "Test" ALTER COLUMN "rating1" SET NOT NULL;
-ALTER TABLE "Test" ALTER COLUMN "rating1" DROP DEFAULT;
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Alter field rating1 on test
---
-ALTER TABLE "Test" ALTER COLUMN "rating1" DROP NOT NULL;
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20200602162923-0006_organization_organizationtouserlink.js b/apps/_demo/migrations/20200602162923-0006_organization_organizationtouserlink.js
deleted file mode 100644
index c4117b37..00000000
--- a/apps/_demo/migrations/20200602162923-0006_organization_organizationtouserlink.js
+++ /dev/null
@@ -1,46 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0006_organization_organizationtouserlink:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMC42IG9uIDIwMjAtMDYtMDIgMTE6MjkKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKaW1wb3J0IGRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24KCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMDVfYXV0b18yMDIwMDUyOV8xOTMwJyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkNyZWF0ZU1vZGVsKAogICAgICAgICAgICBuYW1lPSdvcmdhbml6YXRpb24nLAogICAgICAgICAgICBmaWVsZHM9WwogICAgICAgICAgICAgICAgKCdpZCcsIG1vZGVscy5BdXRvRmllbGQocHJpbWFyeV9rZXk9VHJ1ZSwgc2VyaWFsaXplPUZhbHNlKSksCiAgICAgICAgICAgICAgICAoJ25hbWUnLCBtb2RlbHMuVGV4dEZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCdpc0FjdGl2ZScsIG1vZGVscy5Cb29sZWFuRmllbGQoKSksCiAgICAgICAgICAgICAgICAoJ3VwZGF0ZWRBdF91dGMnLCBtb2RlbHMuRGF0ZVRpbWVGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgndXBkYXRlZEF0X29mZnNldCcsIG1vZGVscy5UZXh0RmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSksCiAgICAgICAgICAgICAgICAoJ2NyZWF0ZWRBdF91dGMnLCBtb2RlbHMuRGF0ZVRpbWVGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgnY3JlYXRlZEF0X29mZnNldCcsIG1vZGVscy5UZXh0RmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSksCiAgICAgICAgICAgICAgICAoJ2NyZWF0ZWRCeScsIG1vZGVscy5Gb3JlaWduS2V5KGJsYW5rPVRydWUsIGRiX2NvbHVtbj0nY3JlYXRlZEJ5JywgbnVsbD1UcnVlLCBvbl9kZWxldGU9ZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbi5ET19OT1RISU5HLCByZWxhdGVkX25hbWU9JysnLCB0bz0nX2RqYW5nb19zY2hlbWEudXNlcicpKSwKICAgICAgICAgICAgICAgICgndXBkYXRlZEJ5JywgbW9kZWxzLkZvcmVpZ25LZXkoYmxhbms9VHJ1ZSwgZGJfY29sdW1uPSd1cGRhdGVkQnknLCBudWxsPVRydWUsIG9uX2RlbGV0ZT1kamFuZ28uZGIubW9kZWxzLmRlbGV0aW9uLkRPX05PVEhJTkcsIHJlbGF0ZWRfbmFtZT0nKycsIHRvPSdfZGphbmdvX3NjaGVtYS51c2VyJykpLAogICAgICAgICAgICBdLAogICAgICAgICAgICBvcHRpb25zPXsKICAgICAgICAgICAgICAgICdkYl90YWJsZSc6ICdPcmdhbml6YXRpb24nLAogICAgICAgICAgICB9LAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5DcmVhdGVNb2RlbCgKICAgICAgICAgICAgbmFtZT0nb3JnYW5pemF0aW9udG91c2VybGluaycsCiAgICAgICAgICAgIGZpZWxkcz1bCiAgICAgICAgICAgICAg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ywgdG89J19kamFuZ29fc2NoZW1hLm9yZ2FuaXphdGlvbicpKSwKICAgICAgICAgICAgICAgICgndXBkYXRlZEJ5JywgbW9kZWxzLkZvcmVpZ25LZXkoYmxhbms9VHJ1ZSwgZGJfY29sdW1uPSd1cGRhdGVkQnknLCBudWxsPVRydWUsIG9uX2RlbGV0ZT1kamFuZ28uZGIubW9kZWxzLmRlbGV0aW9uLkRPX05PVEhJTkcsIHJlbGF0ZWRfbmFtZT0nKycsIHRvPSdfZGphbmdvX3NjaGVtYS51c2VyJykpLAogICAgICAgICAgICAgICAgKCd1c2VyJywgbW9kZWxzLkZvcmVpZ25LZXkoYmxhbms9VHJ1ZSwgZGJfY29sdW1uPSd1c2VyJywgbnVsbD1UcnVlLCBvbl9kZWxldGU9ZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbi5ET19OT1RISU5HLCByZWxhdGVkX25hbWU9JysnLCB0bz0nX2RqYW5nb19zY2hlbWEudXNlcicpKSwKICAgICAgICAgICAgXSwKICAgICAgICAgICAgb3B0aW9ucz17CiAgICAgICAgICAgICAgICAnZGJfdGFibGUnOiAnT3JnYW5pemF0aW9uVG9Vc2VyTGluaycsCiAgICAgICAgICAgIH0sCiAgICAgICAgKSwKICAgIF0K
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Create model organization
---
-CREATE TABLE "Organization" ("id" serial NOT NULL PRIMARY KEY, "name" text NULL, "isActive" boolean NOT NULL, "updatedAt_utc" timestamp with time zone NULL, "updatedAt_offset" text NULL, "createdAt_utc" timestamp with time zone NULL, "createdAt_offset" text NULL, "createdBy" integer NULL, "updatedBy" integer NULL);
---
--- Create model organizationtouserlink
---
-CREATE TABLE "OrganizationToUserLink" ("id" serial NOT NULL PRIMARY KEY, "role" varchar(50) NOT NULL, "updatedAt_utc" timestamp with time zone NULL, "updatedAt_offset" text NULL, "createdAt_utc" timestamp with time zone NULL, "createdAt_offset" text NULL, "createdBy" integer NULL, "organization" integer NULL, "updatedBy" integer NULL, "user" integer NULL);
-ALTER TABLE "Organization" ADD CONSTRAINT "Organization_createdBy_1dd7d630_fk_User_id" FOREIGN KEY ("createdBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "Organization" ADD CONSTRAINT "Organization_updatedBy_e4a88050_fk_User_id" FOREIGN KEY ("updatedBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-CREATE INDEX "Organization_createdBy_1dd7d630" ON "Organization" ("createdBy");
-CREATE INDEX "Organization_updatedBy_e4a88050" ON "Organization" ("updatedBy");
-ALTER TABLE "OrganizationToUserLink" ADD CONSTRAINT "OrganizationToUserLink_createdBy_2c72c4aa_fk_User_id" FOREIGN KEY ("createdBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "OrganizationToUserLink" ADD CONSTRAINT "OrganizationToUserLink_organization_047b72d2_fk_Organization_id" FOREIGN KEY ("organization") REFERENCES "Organization" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "OrganizationToUserLink" ADD CONSTRAINT "OrganizationToUserLink_updatedBy_758766b7_fk_User_id" FOREIGN KEY ("updatedBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "OrganizationToUserLink" ADD CONSTRAINT "OrganizationToUserLink_user_d86c251a_fk_User_id" FOREIGN KEY ("user") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-CREATE INDEX "OrganizationToUserLink_createdBy_2c72c4aa" ON "OrganizationToUserLink" ("createdBy");
-CREATE INDEX "OrganizationToUserLink_organization_047b72d2" ON "OrganizationToUserLink" ("organization");
-CREATE INDEX "OrganizationToUserLink_updatedBy_758766b7" ON "OrganizationToUserLink" ("updatedBy");
-CREATE INDEX "OrganizationToUserLink_user_d86c251a" ON "OrganizationToUserLink" ("user");
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Create model organizationtouserlink
---
-DROP TABLE "OrganizationToUserLink" CASCADE;
---
--- Create model organization
---
-DROP TABLE "Organization" CASCADE;
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20200602193546-0007_user_phone.js b/apps/_demo/migrations/20200602193546-0007_user_phone.js
deleted file mode 100644
index 7ba278a1..00000000
--- a/apps/_demo/migrations/20200602193546-0007_user_phone.js
+++ /dev/null
@@ -1,27 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0007_user_phone:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMC42IG9uIDIwMjAtMDYtMDIgMTQ6MzUKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMDZfb3JnYW5pemF0aW9uX29yZ2FuaXphdGlvbnRvdXNlcmxpbmsnKSwKICAgIF0KCiAgICBvcGVyYXRpb25zID0gWwogICAgICAgIG1pZ3JhdGlvbnMuQWRkRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3VzZXInLAogICAgICAgICAgICBuYW1lPSdwaG9uZScsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5UZXh0RmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlLCB1bmlxdWU9VHJ1ZSksCiAgICAgICAgKSwKICAgIF0K
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Add field phone to user
---
-ALTER TABLE "User" ADD COLUMN "phone" text NULL UNIQUE;
-CREATE INDEX "User_phone_46f113c5_like" ON "User" ("phone" text_pattern_ops);
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Add field phone to user
---
-ALTER TABLE "User" DROP COLUMN "phone" CASCADE;
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20200604160737-0008_auto_20200604_1107.js b/apps/_demo/migrations/20200604160737-0008_auto_20200604_1107.js
deleted file mode 100644
index 76d9deca..00000000
--- a/apps/_demo/migrations/20200604160737-0008_auto_20200604_1107.js
+++ /dev/null
@@ -1,34 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0008_auto_20200604_1107:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMC42IG9uIDIwMjAtMDYtMDQgMTE6MDcKCmltcG9ydCBkamFuZ28uY29udHJpYi5wb3N0Z3Jlcy5maWVsZHMuanNvbmIKZnJvbSBkamFuZ28uZGIgaW1wb3J0IG1pZ3JhdGlvbnMsIG1vZGVscwoKCmNsYXNzIE1pZ3JhdGlvbihtaWdyYXRpb25zLk1pZ3JhdGlvbik6CgogICAgZGVwZW5kZW5jaWVzID0gWwogICAgICAgICgnX2RqYW5nb19zY2hlbWEnLCAnMDAwN191c2VyX3Bob25lJyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkFkZEZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSdvcmdhbml6YXRpb24nLAogICAgICAgICAgICBuYW1lPSdhdmF0YXInLAogICAgICAgICAgICBmaWVsZD1kamFuZ28uY29udHJpYi5wb3N0Z3Jlcy5maWVsZHMuanNvbmIuSlNPTkZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFkZEZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSdvcmdhbml6YXRpb24nLAogICAgICAgICAgICBuYW1lPSdkZXNjcmlwdGlvbicsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5UZXh0RmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgXQo=
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Add field avatar to organization
---
-ALTER TABLE "Organization" ADD COLUMN "avatar" jsonb NULL;
---
--- Add field description to organization
---
-ALTER TABLE "Organization" ADD COLUMN "description" text NULL;
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Add field description to organization
---
-ALTER TABLE "Organization" DROP COLUMN "description" CASCADE;
---
--- Add field avatar to organization
---
-ALTER TABLE "Organization" DROP COLUMN "avatar" CASCADE;
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20200604214642-0009_auto_20200604_1646.js b/apps/_demo/migrations/20200604214642-0009_auto_20200604_1646.js
deleted file mode 100644
index 2263ec50..00000000
--- a/apps/_demo/migrations/20200604214642-0009_auto_20200604_1646.js
+++ /dev/null
@@ -1,28 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0009_auto_20200604_1646:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMC42IG9uIDIwMjAtMDYtMDQgMTY6NDYKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMDhfYXV0b18yMDIwMDYwNF8xMTA3JyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3VzZXInLAogICAgICAgICAgICBuYW1lPSdwaG9uZScsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5UZXh0RmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgXQo=
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Alter field phone on user
---
-ALTER TABLE "User" DROP CONSTRAINT "User_phone_key";
-DROP INDEX IF EXISTS "User_phone_46f113c5_like";
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Alter field phone on user
---
-ALTER TABLE "User" ADD CONSTRAINT "User_phone_46f113c5_uniq" UNIQUE ("phone");
-CREATE INDEX "User_phone_46f113c5_like" ON "User" ("phone" text_pattern_ops);
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20200605011137-0010_auto_20200604_2012.js b/apps/_demo/migrations/20200605011137-0010_auto_20200604_2012.js
deleted file mode 100644
index 165d978b..00000000
--- a/apps/_demo/migrations/20200605011137-0010_auto_20200604_2012.js
+++ /dev/null
@@ -1,31 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0010_auto_20200604_2012:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMC42IG9uIDIwMjAtMDYtMDQgMjA6MTIKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKaW1wb3J0IGRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24KCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMDlfYXV0b18yMDIwMDYwNF8xNjQ2JyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J29yZ2FuaXphdGlvbnRvdXNlcmxpbmsnLAogICAgICAgICAgICBuYW1lPSdvcmdhbml6YXRpb24nLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuRm9yZWlnbktleShkYl9jb2x1bW49J29yZ2FuaXphdGlvbicsIG9uX2RlbGV0ZT1kamFuZ28uZGIubW9kZWxzLmRlbGV0aW9uLkRPX05PVEhJTkcsIHJlbGF0ZWRfbmFtZT0nKycsIHRvPSdfZGphbmdvX3NjaGVtYS5vcmdhbml6YXRpb24nKSwKICAgICAgICApLAogICAgXQo=
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Alter field organization on organizationtouserlink
---
-SET CONSTRAINTS "OrganizationToUserLink_organization_047b72d2_fk_Organization_id" IMMEDIATE; ALTER TABLE "OrganizationToUserLink" DROP CONSTRAINT "OrganizationToUserLink_organization_047b72d2_fk_Organization_id";
-DELETE FROM "OrganizationToUserLink" WHERE "organization" is NULL OR "user" is NULL;
-ALTER TABLE "OrganizationToUserLink" ALTER COLUMN "organization" SET NOT NULL;
-ALTER TABLE "OrganizationToUserLink" ADD CONSTRAINT "OrganizationToUserLink_organization_047b72d2_fk_Organization_id" FOREIGN KEY ("organization") REFERENCES "Organization" ("id") DEFERRABLE INITIALLY DEFERRED;
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Alter field organization on organizationtouserlink
---
-SET CONSTRAINTS "OrganizationToUserLink_organization_047b72d2_fk_Organization_id" IMMEDIATE; ALTER TABLE "OrganizationToUserLink" DROP CONSTRAINT "OrganizationToUserLink_organization_047b72d2_fk_Organization_id";
-ALTER TABLE "OrganizationToUserLink" ALTER COLUMN "organization" DROP NOT NULL;
-ALTER TABLE "OrganizationToUserLink" ADD CONSTRAINT "OrganizationToUserLink_organization_047b72d2_fk_Organization_id" FOREIGN KEY ("organization") REFERENCES "Organization" ("id") DEFERRABLE INITIALLY DEFERRED;
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20200605012057-0011_auto_20200604_2021.js b/apps/_demo/migrations/20200605012057-0011_auto_20200604_2021.js
deleted file mode 100644
index a88582bb..00000000
--- a/apps/_demo/migrations/20200605012057-0011_auto_20200604_2021.js
+++ /dev/null
@@ -1,38 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0011_auto_20200604_2021:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMC42IG9uIDIwMjAtMDYtMDQgMjA6MjEKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKaW1wb3J0IGRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24KCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMTBfYXV0b18yMDIwMDYwNF8yMDEyJyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J29yZ2FuaXphdGlvbnRvdXNlcmxpbmsnLAogICAgICAgICAgICBuYW1lPSdyb2xlJywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLkNoYXJGaWVsZChibGFuaz1UcnVlLCBjaG9pY2VzPVsoJ293bmVyJywgJ293bmVyJyksICgnbWVtYmVyJywgJ21lbWJlcicpXSwgbWF4X2xlbmd0aD01MCwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWx0ZXJGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0nb3JnYW5pemF0aW9udG91c2VybGluaycsCiAgICAgICAgICAgIG5hbWU9J3VzZXInLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuRm9yZWlnbktleShkYl9jb2x1bW49J3VzZXInLCBvbl9kZWxldGU9ZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbi5ET19OT1RISU5HLCByZWxhdGVkX25hbWU9JysnLCB0bz0nX2RqYW5nb19zY2hlbWEudXNlcicpLAogICAgICAgICksCiAgICBdCg==
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Alter field role on organizationtouserlink
---
-ALTER TABLE "OrganizationToUserLink" ALTER COLUMN "role" DROP NOT NULL;
---
--- Alter field user on organizationtouserlink
---
-SET CONSTRAINTS "OrganizationToUserLink_user_d86c251a_fk_User_id" IMMEDIATE; ALTER TABLE "OrganizationToUserLink" DROP CONSTRAINT "OrganizationToUserLink_user_d86c251a_fk_User_id";
-ALTER TABLE "OrganizationToUserLink" ALTER COLUMN "user" SET NOT NULL;
-ALTER TABLE "OrganizationToUserLink" ADD CONSTRAINT "OrganizationToUserLink_user_d86c251a_fk_User_id" FOREIGN KEY ("user") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Alter field user on organizationtouserlink
---
-SET CONSTRAINTS "OrganizationToUserLink_user_d86c251a_fk_User_id" IMMEDIATE; ALTER TABLE "OrganizationToUserLink" DROP CONSTRAINT "OrganizationToUserLink_user_d86c251a_fk_User_id";
-ALTER TABLE "OrganizationToUserLink" ALTER COLUMN "user" DROP NOT NULL;
-ALTER TABLE "OrganizationToUserLink" ADD CONSTRAINT "OrganizationToUserLink_user_d86c251a_fk_User_id" FOREIGN KEY ("user") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
---
--- Alter field role on organizationtouserlink
---
-ALTER TABLE "OrganizationToUserLink" ALTER COLUMN "role" SET NOT NULL;
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20200605171927-0012_test_related_many.js b/apps/_demo/migrations/20200605171927-0012_test_related_many.js
deleted file mode 100644
index 9d83be8e..00000000
--- a/apps/_demo/migrations/20200605171927-0012_test_related_many.js
+++ /dev/null
@@ -1,30 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0012_test_related_many:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMC42IG9uIDIwMjAtMDYtMDUgMTI6MTkKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKaW1wb3J0IGRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24KCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMTFfYXV0b18yMDIwMDYwNF8yMDIxJyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkNyZWF0ZU1vZGVsKAogICAgICAgICAgICBuYW1lPSd0ZXN0X3JlbGF0ZWRfbWFueScsCiAgICAgICAgICAgIGZpZWxkcz1bCiAgICAgICAgICAgICAgICAoJ2lkJywgbW9kZWxzLkF1dG9GaWVsZChhdXRvX2NyZWF0ZWQ9VHJ1ZSwgcHJpbWFyeV9rZXk9VHJ1ZSwgc2VyaWFsaXplPUZhbHNlLCB2ZXJib3NlX25hbWU9J0lEJykpLAogICAgICAgICAgICAgICAgKCdUZXN0X2xlZnRfaWQnLCBtb2RlbHMuRm9yZWlnbktleShkYl9jb2x1bW49J1Rlc3RfbGVmdF9pZCcsIG9uX2RlbGV0ZT1kamFuZ28uZGIubW9kZWxzLmRlbGV0aW9uLkNBU0NBREUsIHJlbGF0ZWRfbmFtZT0nKycsIHRvPSdfZGphbmdvX3NjaGVtYS50ZXN0JykpLAogICAgICAgICAgICAgICAgKCdUZXN0X3JpZ2h0X2lkJywgbW9kZWxzLkZvcmVpZ25LZXkoZGJfY29sdW1uPSdUZXN0X3JpZ2h0X2lkJywgb25fZGVsZXRlPWRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24uQ0FTQ0FERSwgcmVsYXRlZF9uYW1lPScrJywgdG89J19kamFuZ29fc2NoZW1hLnRlc3QnKSksCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgIG9wdGlvbnM9ewogICAgICAgICAgICAgICAgJ2RiX3RhYmxlJzogJ1Rlc3RfcmVsYXRlZF9tYW55JywKICAgICAgICAgICAgfSwKICAgICAgICApLAogICAgXQo=
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Create model test_related_many
---
-CREATE TABLE "Test_related_many" ("id" serial NOT NULL PRIMARY KEY, "Test_left_id" integer NOT NULL, "Test_right_id" integer NOT NULL);
-ALTER TABLE "Test_related_many" ADD CONSTRAINT "Test_related_many_Test_left_id_3ffb833f_fk_Test_id" FOREIGN KEY ("Test_left_id") REFERENCES "Test" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "Test_related_many" ADD CONSTRAINT "Test_related_many_Test_right_id_fa79fd5e_fk_Test_id" FOREIGN KEY ("Test_right_id") REFERENCES "Test" ("id") DEFERRABLE INITIALLY DEFERRED;
-CREATE INDEX "Test_related_many_Test_left_id_3ffb833f" ON "Test_related_many" ("Test_left_id");
-CREATE INDEX "Test_related_many_Test_right_id_fa79fd5e" ON "Test_related_many" ("Test_right_id");
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Create model test_related_many
---
-DROP TABLE "Test_related_many" CASCADE;
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20200610003032-0013_remove_organization_isactive.js b/apps/_demo/migrations/20200610003032-0013_remove_organization_isactive.js
deleted file mode 100644
index 1093a59d..00000000
--- a/apps/_demo/migrations/20200610003032-0013_remove_organization_isactive.js
+++ /dev/null
@@ -1,26 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0013_remove_organization_isactive:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMC42IG9uIDIwMjAtMDYtMDkgMTk6MzAKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zCgoKY2xhc3MgTWlncmF0aW9uKG1pZ3JhdGlvbnMuTWlncmF0aW9uKToKCiAgICBkZXBlbmRlbmNpZXMgPSBbCiAgICAgICAgKCdfZGphbmdvX3NjaGVtYScsICcwMDEyX3Rlc3RfcmVsYXRlZF9tYW55JyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLlJlbW92ZUZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSdvcmdhbml6YXRpb24nLAogICAgICAgICAgICBuYW1lPSdpc0FjdGl2ZScsCiAgICAgICAgKSwKICAgIF0K
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Remove field isActive from organization
---
-ALTER TABLE "Organization" DROP COLUMN "isActive" CASCADE;
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Remove field isActive from organization
---
-ALTER TABLE "Organization" ADD COLUMN "isActive" boolean NOT NULL;
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20200610013950-0014_auto_20200609_2040.js b/apps/_demo/migrations/20200610013950-0014_auto_20200609_2040.js
deleted file mode 100644
index 8b15e3ff..00000000
--- a/apps/_demo/migrations/20200610013950-0014_auto_20200609_2040.js
+++ /dev/null
@@ -1,36 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0014_auto_20200609_2040:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMC42IG9uIDIwMjAtMDYtMDkgMjA6NDAKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMTNfcmVtb3ZlX29yZ2FuaXphdGlvbl9pc2FjdGl2ZScpLAogICAgXQoKICAgIG9wZXJhdGlvbnMgPSBbCiAgICAgICAgbWlncmF0aW9ucy5BZGRGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0nb3JnYW5pemF0aW9udG91c2VybGluaycsCiAgICAgICAgICAgIG5hbWU9J2lzQWNjZXB0ZWQnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuQm9vbGVhbkZpZWxkKGRlZmF1bHQ9RmFsc2UpLAogICAgICAgICAgICBwcmVzZXJ2ZV9kZWZhdWx0PUZhbHNlLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BZGRGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0nb3JnYW5pemF0aW9udG91c2VybGluaycsCiAgICAgICAgICAgIG5hbWU9J2lzUmVqZWN0ZWQnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuQm9vbGVhbkZpZWxkKGRlZmF1bHQ9RmFsc2UpLAogICAgICAgICAgICBwcmVzZXJ2ZV9kZWZhdWx0PUZhbHNlLAogICAgICAgICksCiAgICBdCg==
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Add field isAccepted to organizationtouserlink
---
-ALTER TABLE "OrganizationToUserLink" ADD COLUMN "isAccepted" boolean DEFAULT false NOT NULL;
-ALTER TABLE "OrganizationToUserLink" ALTER COLUMN "isAccepted" DROP DEFAULT;
---
--- Add field isRejected to organizationtouserlink
---
-ALTER TABLE "OrganizationToUserLink" ADD COLUMN "isRejected" boolean DEFAULT false NOT NULL;
-ALTER TABLE "OrganizationToUserLink" ALTER COLUMN "isRejected" DROP DEFAULT;
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Add field isRejected to organizationtouserlink
---
-ALTER TABLE "OrganizationToUserLink" DROP COLUMN "isRejected" CASCADE;
---
--- Add field isAccepted to organizationtouserlink
---
-ALTER TABLE "OrganizationToUserLink" DROP COLUMN "isAccepted" CASCADE;
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20200610021618-0015_auto_20200609_2116.js b/apps/_demo/migrations/20200610021618-0015_auto_20200609_2116.js
deleted file mode 100644
index 831d7c6f..00000000
--- a/apps/_demo/migrations/20200610021618-0015_auto_20200609_2116.js
+++ /dev/null
@@ -1,34 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0015_auto_20200609_2116:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMC42IG9uIDIwMjAtMDYtMDkgMjE6MTYKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMTRfYXV0b18yMDIwMDYwOV8yMDQwJyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J29yZ2FuaXphdGlvbnRvdXNlcmxpbmsnLAogICAgICAgICAgICBuYW1lPSdpc0FjY2VwdGVkJywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLkJvb2xlYW5GaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BbHRlckZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSdvcmdhbml6YXRpb250b3VzZXJsaW5rJywKICAgICAgICAgICAgbmFtZT0naXNSZWplY3RlZCcsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5Cb29sZWFuRmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgXQo=
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Alter field isAccepted on organizationtouserlink
---
-ALTER TABLE "OrganizationToUserLink" ALTER COLUMN "isAccepted" DROP NOT NULL;
---
--- Alter field isRejected on organizationtouserlink
---
-ALTER TABLE "OrganizationToUserLink" ALTER COLUMN "isRejected" DROP NOT NULL;
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Alter field isRejected on organizationtouserlink
---
-ALTER TABLE "OrganizationToUserLink" ALTER COLUMN "isRejected" SET NOT NULL;
---
--- Alter field isAccepted on organizationtouserlink
---
-ALTER TABLE "OrganizationToUserLink" ALTER COLUMN "isAccepted" SET NOT NULL;
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20200627150216-0016_auto_20200627_1002.js b/apps/_demo/migrations/20200627150216-0016_auto_20200627_1002.js
deleted file mode 100644
index 009e87cd..00000000
--- a/apps/_demo/migrations/20200627150216-0016_auto_20200627_1002.js
+++ /dev/null
@@ -1,58 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0016_auto_20200627_1002:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMC42IG9uIDIwMjAtMDYtMjcgMTA6MDIKCmltcG9ydCBkamFuZ28uY29udHJpYi5wb3N0Z3Jlcy5maWVsZHMuanNvbmIKZnJvbSBkamFuZ28uZGIgaW1wb3J0IG1pZ3JhdGlvbnMsIG1vZGVscwppbXBvcnQgZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbgoKCmNsYXNzIE1pZ3JhdGlvbihtaWdyYXRpb25zLk1pZ3JhdGlvbik6CgogICAgZGVwZW5kZW5jaWVzID0gWwogICAgICAgICgnX2RqYW5nb19zY2hlbWEnLCAnMDAxNV9hdXRvXzIwMjAwNjA5XzIxMTYnKSwKICAgIF0KCiAgICBvcGVyYXRpb25zID0gWwogICAgICAgIG1pZ3JhdGlvbnMuQWx0ZXJGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0nZm9yZ290cGFzc3dvcmRhY3Rpb24nLAogICAgICAgICAgICBuYW1lPSd1c2VyJywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLkZvcmVpZ25LZXkoZGJfY29sdW1uPSd1c2VyJywgb25fZGVsZXRlPWRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24uQ0FTQ0FERSwgcmVsYXRlZF9uYW1lPScrJywgdG89J19kamFuZ29fc2NoZW1hLnVzZXInKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWx0ZXJGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0nb3JnYW5pemF0aW9uJywKICAgICAgICAgICAgbmFtZT0nbmFtZScsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5UZXh0RmllbGQoKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWx0ZXJGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0nb3JnYW5pemF0aW9udG91c2VybGluaycsCiAgICAgICAgICAgIG5hbWU9J3JvbGUnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuQ2hhckZpZWxkKGNob2ljZXM9Wygnb3duZXInLCAnb3duZXInKSwgKCdtZW1iZXInLCAnbWVtYmVyJyldLCBtYXhfbGVuZ3RoPTUwKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWx0ZXJGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndXNlcicsCiAgICAgICAgICAgIG5hbWU9J3NldHRpbmdzJywKICAgICAgICAgICAgZmllbGQ9ZGphbmdvLmNvbnRyaWIucG9zdGdyZXMuZmllbGRzLmpzb25iLkpTT05GaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpLAogICAgICAgICksCiAgICBdCg==
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Alter field user on forgotpasswordaction
---
-SET CONSTRAINTS "ForgotPasswordAction_user_3c52ec86_fk_User_id" IMMEDIATE; ALTER TABLE "ForgotPasswordAction" DROP CONSTRAINT "ForgotPasswordAction_user_3c52ec86_fk_User_id";
-
--- DELETE USELESS DATA!
-DELETE FROM "ForgotPasswordAction" t where t."user" is NULL;
-
-ALTER TABLE "ForgotPasswordAction" ALTER COLUMN "user" SET NOT NULL;
-ALTER TABLE "ForgotPasswordAction" ADD CONSTRAINT "ForgotPasswordAction_user_3c52ec86_fk_User_id" FOREIGN KEY ("user") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
---
--- Alter field name on organization
---
-ALTER TABLE "Organization" ALTER COLUMN "name" SET NOT NULL;
---
--- Alter field role on organizationtouserlink
---
-ALTER TABLE "OrganizationToUserLink" ALTER COLUMN "role" SET NOT NULL;
---
--- Alter field settings on user
---
-ALTER TABLE "User" ALTER COLUMN "settings" TYPE jsonb USING "settings"::jsonb;
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Alter field settings on user
---
-ALTER TABLE "User" ALTER COLUMN "settings" TYPE text USING "settings"::text;
---
--- Alter field role on organizationtouserlink
---
-ALTER TABLE "OrganizationToUserLink" ALTER COLUMN "role" DROP NOT NULL;
---
--- Alter field name on organization
---
-ALTER TABLE "Organization" ALTER COLUMN "name" DROP NOT NULL;
---
--- Alter field user on forgotpasswordaction
---
-SET CONSTRAINTS "ForgotPasswordAction_user_3c52ec86_fk_User_id" IMMEDIATE; ALTER TABLE "ForgotPasswordAction" DROP CONSTRAINT "ForgotPasswordAction_user_3c52ec86_fk_User_id";
-ALTER TABLE "ForgotPasswordAction" ALTER COLUMN "user" DROP NOT NULL;
-ALTER TABLE "ForgotPasswordAction" ADD CONSTRAINT "ForgotPasswordAction_user_3c52ec86_fk_User_id" FOREIGN KEY ("user") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20200627153246-0017_auto_20200627_1032.js b/apps/_demo/migrations/20200627153246-0017_auto_20200627_1032.js
deleted file mode 100644
index 56b8a897..00000000
--- a/apps/_demo/migrations/20200627153246-0017_auto_20200627_1032.js
+++ /dev/null
@@ -1,30 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0017_auto_20200627_1032:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMC42IG9uIDIwMjAtMDYtMjcgMTA6MzIKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKaW1wb3J0IGRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24KCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMTZfYXV0b18yMDIwMDYyN18xMDAyJyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J2ZvcmdvdHBhc3N3b3JkYWN0aW9uJywKICAgICAgICAgICAgbmFtZT0ndXNlcicsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5Gb3JlaWduS2V5KGJsYW5rPVRydWUsIGRiX2NvbHVtbj0ndXNlcicsIG51bGw9VHJ1ZSwgb25fZGVsZXRlPWRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24uRE9fTk9USElORywgcmVsYXRlZF9uYW1lPScrJywgdG89J19kamFuZ29fc2NoZW1hLnVzZXInKSwKICAgICAgICApLAogICAgXQo=
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Alter field user on forgotpasswordaction
---
-SET CONSTRAINTS "ForgotPasswordAction_user_3c52ec86_fk_User_id" IMMEDIATE; ALTER TABLE "ForgotPasswordAction" DROP CONSTRAINT "ForgotPasswordAction_user_3c52ec86_fk_User_id";
-ALTER TABLE "ForgotPasswordAction" ALTER COLUMN "user" DROP NOT NULL;
-ALTER TABLE "ForgotPasswordAction" ADD CONSTRAINT "ForgotPasswordAction_user_3c52ec86_fk_User_id" FOREIGN KEY ("user") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Alter field user on forgotpasswordaction
---
-SET CONSTRAINTS "ForgotPasswordAction_user_3c52ec86_fk_User_id" IMMEDIATE; ALTER TABLE "ForgotPasswordAction" DROP CONSTRAINT "ForgotPasswordAction_user_3c52ec86_fk_User_id";
-ALTER TABLE "ForgotPasswordAction" ALTER COLUMN "user" SET NOT NULL;
-ALTER TABLE "ForgotPasswordAction" ADD CONSTRAINT "ForgotPasswordAction_user_3c52ec86_fk_User_id" FOREIGN KEY ("user") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20200706171722-0018_user_meta.js b/apps/_demo/migrations/20200706171722-0018_user_meta.js
deleted file mode 100644
index 979a6ee1..00000000
--- a/apps/_demo/migrations/20200706171722-0018_user_meta.js
+++ /dev/null
@@ -1,26 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0018_user_meta:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMC42IG9uIDIwMjAtMDctMDYgMTI6MTcKCmltcG9ydCBkamFuZ28uY29udHJpYi5wb3N0Z3Jlcy5maWVsZHMuanNvbmIKZnJvbSBkamFuZ28uZGIgaW1wb3J0IG1pZ3JhdGlvbnMKCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMTdfYXV0b18yMDIwMDYyN18xMDMyJyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkFkZEZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd1c2VyJywKICAgICAgICAgICAgbmFtZT0nbWV0YScsCiAgICAgICAgICAgIGZpZWxkPWRqYW5nby5jb250cmliLnBvc3RncmVzLmZpZWxkcy5qc29uYi5KU09ORmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgXQo=
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Add field meta to user
---
-ALTER TABLE "User" ADD COLUMN "meta" jsonb NULL;
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Add field meta to user
---
-ALTER TABLE "User" DROP COLUMN "meta" CASCADE;
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20200729131257-0019_auto_20200729_1013.js b/apps/_demo/migrations/20200729131257-0019_auto_20200729_1013.js
deleted file mode 100644
index 138a576c..00000000
--- a/apps/_demo/migrations/20200729131257-0019_auto_20200729_1013.js
+++ /dev/null
@@ -1,81 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0019_auto_20200729_1013:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMC42IG9uIDIwMjAtMDctMjkgMTA6MTMKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKaW1wb3J0IGRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24KCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMThfdXNlcl9tZXRhJyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkFkZEZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSdvcmdhbml6YXRpb250b3VzZXJsaW5rJywKICAgICAgICAgICAgbmFtZT0nY29kZScsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5VVUlERmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlLCB1bmlxdWU9VHJ1ZSksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFkZEZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSdvcmdhbml6YXRpb250b3VzZXJsaW5rJywKICAgICAgICAgICAgbmFtZT0nZW1haWwnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuVGV4dEZpZWxkKGRlZmF1bHQ9J25vQGV4YW1wbGUuY29tJyksCiAgICAgICAgICAgIHByZXNlcnZlX2RlZmF1bHQ9RmFsc2UsCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFkZEZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSdvcmdhbml6YXRpb250b3VzZXJsaW5rJywKICAgICAgICAgICAgbmFtZT0nbmFtZScsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5UZXh0RmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWRkRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J29yZ2FuaXphdGlvbnRvdXNlcmxpbmsnLAogICAgICAgICAgICBuYW1lPSdwaG9uZScsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5UZXh0RmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWRkRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3VzZXInLAogICAgICAgICAgICBuYW1lPSdpc0VtYWlsVmVyaWZpZWQnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuQm9vbGVhbkZpZWxkKGRlZmF1bHQ9RmFsc2UpLAogICAgICAgICAgICBwcmVzZXJ2ZV9kZWZhdWx0PUZhbHNlLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BZGRGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndXNlcicsCiAgICAgICAgICAgIG5hbWU9J2lzUGhvbmVWZXJpZmllZCcsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5Cb29sZWFuRmllbGQoZGVmYXVsdD1GYWxzZSksCiAgICAgICAgICAgIHByZXNlcnZlX2RlZmF1bHQ9RmFsc2UsCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J29yZ2FuaXphdGlvbnRvdXNlcmxpbmsnLAogICAgICAgICAgICBuYW1lPSd1c2VyJywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLkZvcmVpZ25LZXkoYmxhbms9VHJ1ZSwgZGJfY29sdW1uPSd1c2VyJywgbnVsbD1UcnVlLCBvbl9kZWxldGU9ZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbi5ET19OT1RISU5HLCByZWxhdGVkX25hbWU9JysnLCB0bz0nX2RqYW5nb19zY2hlbWEudXNlcicpLAogICAgICAgICksCiAgICBdCg==
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Add field code to organizationtouserlink
---
-ALTER TABLE "OrganizationToUserLink" ADD COLUMN "code" uuid NULL UNIQUE;
---
--- Add field email to organizationtouserlink
---
-ALTER TABLE "OrganizationToUserLink" ADD COLUMN "email" text DEFAULT 'no@example.com' NOT NULL;
-ALTER TABLE "OrganizationToUserLink" ALTER COLUMN "email" DROP DEFAULT;
---
--- Add field name to organizationtouserlink
---
-ALTER TABLE "OrganizationToUserLink" ADD COLUMN "name" text NULL;
---
--- Add field phone to organizationtouserlink
---
-ALTER TABLE "OrganizationToUserLink" ADD COLUMN "phone" text NULL;
---
--- Add field isEmailVerified to user
---
-ALTER TABLE "User" ADD COLUMN "isEmailVerified" boolean DEFAULT false NOT NULL;
--- ALTER TABLE "User" ALTER COLUMN "isEmailVerified" DROP DEFAULT;
---
--- Add field isPhoneVerified to user
---
-ALTER TABLE "User" ADD COLUMN "isPhoneVerified" boolean DEFAULT false NOT NULL;
--- ALTER TABLE "User" ALTER COLUMN "isPhoneVerified" DROP DEFAULT;
---
--- Alter field user on organizationtouserlink
---
-SET CONSTRAINTS "OrganizationToUserLink_user_d86c251a_fk_User_id" IMMEDIATE; ALTER TABLE "OrganizationToUserLink" DROP CONSTRAINT "OrganizationToUserLink_user_d86c251a_fk_User_id";
-ALTER TABLE "OrganizationToUserLink" ALTER COLUMN "user" DROP NOT NULL;
-ALTER TABLE "OrganizationToUserLink" ADD CONSTRAINT "OrganizationToUserLink_user_d86c251a_fk_User_id" FOREIGN KEY ("user") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Alter field user on organizationtouserlink
---
-SET CONSTRAINTS "OrganizationToUserLink_user_d86c251a_fk_User_id" IMMEDIATE; ALTER TABLE "OrganizationToUserLink" DROP CONSTRAINT "OrganizationToUserLink_user_d86c251a_fk_User_id";
-ALTER TABLE "OrganizationToUserLink" ALTER COLUMN "user" SET NOT NULL;
-ALTER TABLE "OrganizationToUserLink" ADD CONSTRAINT "OrganizationToUserLink_user_d86c251a_fk_User_id" FOREIGN KEY ("user") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
---
--- Add field isPhoneVerified to user
---
-ALTER TABLE "User" DROP COLUMN "isPhoneVerified" CASCADE;
---
--- Add field isEmailVerified to user
---
-ALTER TABLE "User" DROP COLUMN "isEmailVerified" CASCADE;
---
--- Add field phone to organizationtouserlink
---
-ALTER TABLE "OrganizationToUserLink" DROP COLUMN "phone" CASCADE;
---
--- Add field name to organizationtouserlink
---
-ALTER TABLE "OrganizationToUserLink" DROP COLUMN "name" CASCADE;
---
--- Add field email to organizationtouserlink
---
-ALTER TABLE "OrganizationToUserLink" DROP COLUMN "email" CASCADE;
---
--- Add field code to organizationtouserlink
---
-ALTER TABLE "OrganizationToUserLink" DROP COLUMN "code" CASCADE;
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20200822020912-0020_user_importid.js b/apps/_demo/migrations/20200822020912-0020_user_importid.js
deleted file mode 100644
index 29c7ac27..00000000
--- a/apps/_demo/migrations/20200822020912-0020_user_importid.js
+++ /dev/null
@@ -1,26 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0020_user_importid:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMC42IG9uIDIwMjAtMDgtMjEgMjE6MDkKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMTlfYXV0b18yMDIwMDcyOV8xMDEzJyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkFkZEZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd1c2VyJywKICAgICAgICAgICAgbmFtZT0naW1wb3J0SWQnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuVGV4dEZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgIF0K
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Add field importId to user
---
-ALTER TABLE "User" ADD COLUMN "importId" text NULL;
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Add field importId to user
---
-ALTER TABLE "User" DROP COLUMN "importId" CASCADE;
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20201016113521-0021_auto_20201016_0835.js b/apps/_demo/migrations/20201016113521-0021_auto_20201016_0835.js
deleted file mode 100644
index 8e841db6..00000000
--- a/apps/_demo/migrations/20201016113521-0021_auto_20201016_0835.js
+++ /dev/null
@@ -1,36 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0021_auto_20201016_0835:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjAtMTAtMTYgMDg6MzUKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMjBfdXNlcl9pbXBvcnRpZCcpLAogICAgXQoKICAgIG9wZXJhdGlvbnMgPSBbCiAgICAgICAgbWlncmF0aW9ucy5BbHRlckZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd1c2VyJywKICAgICAgICAgICAgbmFtZT0naW1wb3J0SWQnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuVGV4dEZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSwgdW5pcXVlPVRydWUpLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BbHRlckZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd1c2VyJywKICAgICAgICAgICAgbmFtZT0ncGhvbmUnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuVGV4dEZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSwgdW5pcXVlPVRydWUpLAogICAgICAgICksCiAgICBdCg==
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Alter field importId on user
---
-ALTER TABLE "User" ADD CONSTRAINT "User_importId_1ba44fc8_uniq" UNIQUE ("importId");
-CREATE INDEX "User_importId_1ba44fc8_like" ON "User" ("importId" text_pattern_ops);
---
--- Alter field phone on user
---
-ALTER TABLE "User" ADD CONSTRAINT "User_phone_46f113c5_uniq" UNIQUE ("phone");
-CREATE INDEX "User_phone_46f113c5_like" ON "User" ("phone" text_pattern_ops);
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Alter field phone on user
---
-DROP INDEX IF EXISTS "User_phone_46f113c5_like";
---
--- Alter field importId on user
---
-DROP INDEX IF EXISTS "User_importId_1ba44fc8_like";
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20201105140205-0022_auto_20201105_1102.js b/apps/_demo/migrations/20201105140205-0022_auto_20201105_1102.js
deleted file mode 100644
index a1c6982a..00000000
--- a/apps/_demo/migrations/20201105140205-0022_auto_20201105_1102.js
+++ /dev/null
@@ -1,77 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0022_auto_20201105_1102:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4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ICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWRkRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3QnLAogICAgICAgICAgICBuYW1lPSd1cGRhdGVkQXRfb2Zmc2V0JywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLlRleHRGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BZGRGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdCcsCiAgICAgICAgICAgIG5hbWU9J3VwZGF0ZWRBdF91dGMnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuRGF0ZVRpbWVGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BZGRGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdCcsCiAgICAgICAgICAgIG5hbWU9J3VwZGF0ZWRCeScsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5Gb3JlaWduS2V5KGJsYW5rPVRydWUsIGRiX2NvbHVtbj0ndXBkYXRlZEJ5JywgbnVsbD1UcnVlLCBvbl9kZWxldGU9ZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbi5ET19OT1RISU5HLCByZWxhdGVkX25hbWU9JysnLCB0bz0nX2RqYW5nb19zY2hlbWEudXNlcicpLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BZGRGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdCcsCiAgICAgICAgICAgIG5hbWU9J3YnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuSW50ZWdlckZpZWxkKGRlZmF1bHQ9MSksCiAgICAgICAgKSwKICAgIF0K
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Add field createdAt_offset to test
---
-ALTER TABLE "Test" ADD COLUMN "createdAt_offset" text NULL;
---
--- Add field createdAt_utc to test
---
-ALTER TABLE "Test" ADD COLUMN "createdAt_utc" timestamp with time zone NULL;
---
--- Add field createdBy to test
---
-ALTER TABLE "Test" ADD COLUMN "createdBy" integer NULL CONSTRAINT "Test_createdBy_9a764e99_fk_User_id" REFERENCES "User"("id") DEFERRABLE INITIALLY DEFERRED; SET CONSTRAINTS "Test_createdBy_9a764e99_fk_User_id" IMMEDIATE;
---
--- Add field updatedAt_offset to test
---
-ALTER TABLE "Test" ADD COLUMN "updatedAt_offset" text NULL;
---
--- Add field updatedAt_utc to test
---
-ALTER TABLE "Test" ADD COLUMN "updatedAt_utc" timestamp with time zone NULL;
---
--- Add field updatedBy to test
---
-ALTER TABLE "Test" ADD COLUMN "updatedBy" integer NULL CONSTRAINT "Test_updatedBy_6e1a57ea_fk_User_id" REFERENCES "User"("id") DEFERRABLE INITIALLY DEFERRED; SET CONSTRAINTS "Test_updatedBy_6e1a57ea_fk_User_id" IMMEDIATE;
---
--- Add field v to test
---
-ALTER TABLE "Test" ADD COLUMN "v" integer DEFAULT 1 NOT NULL;
-ALTER TABLE "Test" ALTER COLUMN "v" DROP DEFAULT;
-CREATE INDEX "Test_createdBy_9a764e99" ON "Test" ("createdBy");
-CREATE INDEX "Test_updatedBy_6e1a57ea" ON "Test" ("updatedBy");
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Add field v to test
---
-ALTER TABLE "Test" DROP COLUMN "v" CASCADE;
---
--- Add field updatedBy to test
---
-ALTER TABLE "Test" DROP COLUMN "updatedBy" CASCADE;
---
--- Add field updatedAt_utc to test
---
-ALTER TABLE "Test" DROP COLUMN "updatedAt_utc" CASCADE;
---
--- Add field updatedAt_offset to test
---
-ALTER TABLE "Test" DROP COLUMN "updatedAt_offset" CASCADE;
---
--- Add field createdBy to test
---
-ALTER TABLE "Test" DROP COLUMN "createdBy" CASCADE;
---
--- Add field createdAt_utc to test
---
-ALTER TABLE "Test" DROP COLUMN "createdAt_utc" CASCADE;
---
--- Add field createdAt_offset to test
---
-ALTER TABLE "Test" DROP COLUMN "createdAt_offset" CASCADE;
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20201105140724-0023_auto_20201105_1107.js b/apps/_demo/migrations/20201105140724-0023_auto_20201105_1107.js
deleted file mode 100644
index 645f5d70..00000000
--- a/apps/_demo/migrations/20201105140724-0023_auto_20201105_1107.js
+++ /dev/null
@@ -1,42 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0023_auto_20201105_1107:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjAtMTEtMDUgMTE6MDcKCmltcG9ydCBkamFuZ28uY29udHJpYi5wb3N0Z3Jlcy5maWVsZHMuanNvbmIKZnJvbSBkamFuZ28uZGIgaW1wb3J0IG1pZ3JhdGlvbnMsIG1vZGVscwoKCmNsYXNzIE1pZ3JhdGlvbihtaWdyYXRpb25zLk1pZ3JhdGlvbik6CgogICAgZGVwZW5kZW5jaWVzID0gWwogICAgICAgICgnX2RqYW5nb19zY2hlbWEnLCAnMDAyMl9hdXRvXzIwMjAxMTA1XzExMDInKSwKICAgIF0KCiAgICBvcGVyYXRpb25zID0gWwogICAgICAgIG1pZ3JhdGlvbnMuQWRkRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3QnLAogICAgICAgICAgICBuYW1lPSdtZXRhJywKICAgICAgICAgICAgZmllbGQ9ZGphbmdvLmNvbnRyaWIucG9zdGdyZXMuZmllbGRzLmpzb25iLkpTT05GaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BZGRGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdCcsCiAgICAgICAgICAgIG5hbWU9J3JhdGluZycsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5JbnRlZ2VyRmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWRkRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3QnLAogICAgICAgICAgICBuYW1lPSdzZXR0aW5ncycsCiAgICAgICAgICAgIGZpZWxkPWRqYW5nby5jb250cmliLnBvc3RncmVzLmZpZWxkcy5qc29uYi5KU09ORmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgXQo=
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Add field meta to test
---
-ALTER TABLE "Test" ADD COLUMN "meta" jsonb NULL;
---
--- Add field rating to test
---
-ALTER TABLE "Test" ADD COLUMN "rating" integer NULL;
---
--- Add field settings to test
---
-ALTER TABLE "Test" ADD COLUMN "settings" jsonb NULL;
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Add field settings to test
---
-ALTER TABLE "Test" DROP COLUMN "settings" CASCADE;
---
--- Add field rating to test
---
-ALTER TABLE "Test" DROP COLUMN "rating" CASCADE;
---
--- Add field meta to test
---
-ALTER TABLE "Test" DROP COLUMN "meta" CASCADE;
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20201105141545-0024_test_text.js b/apps/_demo/migrations/20201105141545-0024_test_text.js
deleted file mode 100644
index ed891181..00000000
--- a/apps/_demo/migrations/20201105141545-0024_test_text.js
+++ /dev/null
@@ -1,26 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0024_test_text:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjAtMTEtMDUgMTE6MTUKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMjNfYXV0b18yMDIwMTEwNV8xMTA3JyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkFkZEZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd0ZXN0JywKICAgICAgICAgICAgbmFtZT0ndGV4dCcsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5UZXh0RmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgXQo=
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Add field text to test
---
-ALTER TABLE "Test" ADD COLUMN "text" text NULL;
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Add field text to test
---
-ALTER TABLE "Test" DROP COLUMN "text" CASCADE;
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20201106233317-0025_auto_20201106_2033.js b/apps/_demo/migrations/20201106233317-0025_auto_20201106_2033.js
deleted file mode 100644
index 9e17a48a..00000000
--- a/apps/_demo/migrations/20201106233317-0025_auto_20201106_2033.js
+++ /dev/null
@@ -1,66 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0025_auto_20201106_2033:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjAtMTEtMDYgMjA6MzMKCmltcG9ydCBkamFuZ28uY29udHJpYi5wb3N0Z3Jlcy5maWVsZHMuanNvbmIKZnJvbSBkamFuZ28uZGIgaW1wb3J0IG1pZ3JhdGlvbnMsIG1vZGVscwoKCmNsYXNzIE1pZ3JhdGlvbihtaWdyYXRpb25zLk1pZ3JhdGlvbik6CgogICAgZGVwZW5kZW5jaWVzID0gWwogICAgICAgICgnX2RqYW5nb19zY2hlbWEnLCAnMDAyNF90ZXN0X3RleHQnKSwKICAgIF0KCiAgICBvcGVyYXRpb25zID0gWwogICAgICAgIG1pZ3JhdGlvbnMuQWRkRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3QnLAogICAgICAgICAgICBuYW1lPSdkYXRlMV9vZmZzZXQnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuVGV4dEZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFkZEZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd0ZXN0JywKICAgICAgICAgICAgbmFtZT0nZGF0ZTFfdXRjJywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLkRhdGVUaW1lRmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWRkRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3QnLAogICAgICAgICAgICBuYW1lPSdkYXknLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuRGF0ZUZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFkZEZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd0ZXN0JywKICAgICAgICAgICAgbmFtZT0nZmlsZScsCiAgICAgICAgICAgIGZpZWxkPWRqYW5nby5jb250cmliLnBvc3RncmVzLmZpZWxkcy5qc29uYi5KU09ORmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWRkRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3QnLAogICAgICAgICAgICBuYW1lPSdwYXNzX2ZpZWxkJywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLkNoYXJGaWVsZChibGFuaz1UcnVlLCBkYl9jb2x1bW49J3Bhc3MnLCBtYXhfbGVuZ3RoPTYwLCBudWxsPVRydWUpLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BZGRGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdCcsCiAgICAgICAgICAgIG5hbWU9J3V0YycsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5EYXRlVGltZUZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgIF0K
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Add field date1_offset to test
---
-ALTER TABLE "Test" ADD COLUMN "date1_offset" text NULL;
---
--- Add field date1_utc to test
---
-ALTER TABLE "Test" ADD COLUMN "date1_utc" timestamp with time zone NULL;
---
--- Add field day to test
---
-ALTER TABLE "Test" ADD COLUMN "day" date NULL;
---
--- Add field file to test
---
-ALTER TABLE "Test" ADD COLUMN "file" jsonb NULL;
---
--- Add field pass_field to test
---
-ALTER TABLE "Test" ADD COLUMN "pass" varchar(60) NULL;
---
--- Add field utc to test
---
-ALTER TABLE "Test" ADD COLUMN "utc" timestamp with time zone NULL;
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Add field utc to test
---
-ALTER TABLE "Test" DROP COLUMN "utc" CASCADE;
---
--- Add field pass_field to test
---
-ALTER TABLE "Test" DROP COLUMN "pass" CASCADE;
---
--- Add field file to test
---
-ALTER TABLE "Test" DROP COLUMN "file" CASCADE;
---
--- Add field day to test
---
-ALTER TABLE "Test" DROP COLUMN "day" CASCADE;
---
--- Add field date1_utc to test
---
-ALTER TABLE "Test" DROP COLUMN "date1_utc" CASCADE;
---
--- Add field date1_offset to test
---
-ALTER TABLE "Test" DROP COLUMN "date1_offset" CASCADE;
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20201107004556-0026_auto_20201106_2145.js b/apps/_demo/migrations/20201107004556-0026_auto_20201106_2145.js
deleted file mode 100644
index 069edee0..00000000
--- a/apps/_demo/migrations/20201107004556-0026_auto_20201106_2145.js
+++ /dev/null
@@ -1,91 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0026_auto_20201106_2145:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjAtMTEtMDYgMjE6NDUKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKaW1wb3J0IGRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24KCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMjVfYXV0b18yMDIwMTEwNl8yMDMzJyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J29yZ2FuaXphdGlvbicsCiAgICAgICAgICAgIG5hbWU9J2F2YXRhcicsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5KU09ORmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWx0ZXJGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdCcsCiAgICAgICAgICAgIG5hbWU9J2ZpbGUnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuSlNPTkZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3QnLAogICAgICAgICAgICBuYW1lPSdtZXRhJywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLkpTT05GaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BbHRlckZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd0ZXN0JywKICAgICAgICAgICAgbmFtZT0nc2V0dGluZ3MnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuSlNPTkZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3QnLAogICAgICAgICAgICBuYW1lPSd2ZW51ZScsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5KU09ORmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWx0ZXJGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndXNlcicsCiAgICAgICAgICAgIG5hbWU9J2F2YXRhcicsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5KU09ORmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWx0ZXJGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndXNlcicsCiAgICAgICAgICAgIG5hbWU9J21ldGEnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuSlNPTkZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3VzZXInLAogICAgICAgICAgICBuYW1lPSdzZXR0aW5ncycsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5KU09ORmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQ3JlYXRlTW9kZWwoCiAgICAgICAgICAgIG5hbWU9J3Rlc3RfaGlzdG9yeScsCiAgICAgICAgICAgIGZpZWxkcz1bCiAgICAgICAgICAgICAgICAoJ2RhdGUxX3V0YycsIG1vZGVscy5EYXRlVGltZUZpZWxk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T05GaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgnc3RhdHVzX3JlbmFtZWQnLCBtb2RlbHMuQ2hhckZpZWxkKGNob2ljZXM9WygncGVuZGluZycsICdwZW5kaW5nJyksICgncHJvY2Vzc2VkJywgJ3Byb2Nlc3NlZCcpXSwgbWF4X2xlbmd0aD01MCkpLAogICAgICAgICAgICAgICAgKCd1dWlkJywgbW9kZWxzLlVVSURGaWVsZCgpKSwKICAgICAgICAgICAgICAgICgndXJsJywgbW9kZWxzLlRleHRGaWVsZCgpKSwKICAgICAgICAgICAgICAgICgnc2x1ZycsIG1vZGVscy5UZXh0RmllbGQodW5pcXVlPVRydWUpKSwKICAgICAgICAgICAgICAgICgncmF0aW5nJywgbW9kZWxzLkludGVnZXJGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgnc2V0dGluZ3MnLCBtb2RlbHMuSlNPTkZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCdtZXRhJywgbW9kZWxzLkpTT05GaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgndGV4dCcsIG1vZGVscy5UZXh0RmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSksCiAgICAgICAgICAgICAgICAoJ3VwZGF0ZWRBdF91dGMnLCBtb2RlbHMuRGF0ZVRpbWVGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgndXBkYXRlZEF0X29mZnNldCcsIG1vZGVscy5UZXh0RmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSksCiAgICAgICAgICAgICAgICAoJ2NyZWF0ZWRBdF91dGMnLCBtb2RlbHMuRGF0ZVRpbWVGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgnY3JlYXRlZEF0X29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RlbGV0ZT1kamFuZ28uZGIubW9kZWxzLmRlbGV0aW9uLkRPX05PVEhJTkcsIHJlbGF0ZWRfbmFtZT0nKycsIHRvPSdfZGphbmdvX3NjaGVtYS50ZXN0JykpLAogICAgICAgICAgICAgICAgKCd1cGRhdGVkQnknLCBtb2RlbHMuRm9yZWlnbktleShibGFuaz1UcnVlLCBkYl9jb2x1bW49J3VwZGF0ZWRCeScsIG51bGw9VHJ1ZSwgb25fZGVsZXRlPWRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24uRE9fTk9USElORywgcmVsYXRlZF9uYW1lPScrJywgdG89J19kamFuZ29fc2NoZW1hLnVzZXInKSksCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgIG9wdGlvbnM9ewogICAgICAgICAgICAgICAgJ2RiX3RhYmxlJzogJ1Rlc3RfaGlzdG9yeScsCiAgICAgICAgICAgIH0sCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFkZEZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd0ZXN0JywKICAgICAgICAgICAgbmFtZT0naGlzdG9yeScsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5Gb3JlaWduS2V5KGJsYW5rPVRydWUsIGRiX2NvbHVtbj0naGlzdG9yeScsIG51bGw9VHJ1ZSwgb25fZGVsZXRlPWRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24uRE9fTk9USElORywgcmVsYXRlZF9uYW1lPScrJywgdG89J19kamFuZ29fc2NoZW1hLnRlc3RfaGlzdG9yeScpLAogICAgICAgICksCiAgICBdCg==
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Alter field avatar on organization
---
---
--- Alter field file on test
---
---
--- Alter field meta on test
---
---
--- Alter field settings on test
---
---
--- Alter field venue on test
---
---
--- Alter field avatar on user
---
---
--- Alter field meta on user
---
---
--- Alter field settings on user
---
---
--- Create model test_history
---
-CREATE TABLE "Test_history" ("date1_utc" timestamp with time zone NULL, "date1_offset" text NULL, "utc" timestamp with time zone NULL, "day" date NULL, "file" jsonb NULL, "pass" varchar(60) NULL, "heroColor" text NULL, "isEnabled" boolean NOT NULL, "rating1" integer NOT NULL, "rating2" numeric(8, 2) NULL, "rating3" numeric(18, 4) NULL, "venue" jsonb NULL, "status_renamed" varchar(50) NOT NULL, "uuid" uuid NOT NULL, "url" text NOT NULL, "slug" text NOT NULL UNIQUE, "rating" integer NULL, "settings" jsonb NULL, "meta" jsonb NULL, "text" text NULL, "updatedAt_utc" timestamp with time zone NULL, "updatedAt_offset" text NULL, "createdAt_utc" timestamp with time zone NULL, "createdAt_offset" text NULL, "v" integer NOT NULL, "id" uuid NOT NULL PRIMARY KEY, "history_date" timestamp with time zone NOT NULL, "history_action" varchar(50) NOT NULL, "createdBy" integer NULL, "history_id" integer NOT NULL, "self" integer NULL, "updatedBy" integer NULL);
---
--- Add field history to test
---
-ALTER TABLE "Test" ADD COLUMN "history" uuid NULL CONSTRAINT "Test_history_6cd5696d_fk_Test_history_id" REFERENCES "Test_history"("id") DEFERRABLE INITIALLY DEFERRED; SET CONSTRAINTS "Test_history_6cd5696d_fk_Test_history_id" IMMEDIATE;
-ALTER TABLE "Test_history" ADD CONSTRAINT "Test_history_createdBy_a50667f1_fk_User_id" FOREIGN KEY ("createdBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "Test_history" ADD CONSTRAINT "Test_history_self_99994f16_fk_Test_id" FOREIGN KEY ("self") REFERENCES "Test" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "Test_history" ADD CONSTRAINT "Test_history_updatedBy_1ad3a91d_fk_User_id" FOREIGN KEY ("updatedBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-CREATE INDEX "Test_history_slug_55ce7738_like" ON "Test_history" ("slug" text_pattern_ops);
-CREATE INDEX "Test_history_createdBy_a50667f1" ON "Test_history" ("createdBy");
-CREATE INDEX "Test_history_history_id_6cc6b594" ON "Test_history" ("history_id");
-CREATE INDEX "Test_history_self_99994f16" ON "Test_history" ("self");
-CREATE INDEX "Test_history_updatedBy_1ad3a91d" ON "Test_history" ("updatedBy");
-CREATE INDEX "Test_history_6cd5696d" ON "Test" ("history");
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Add field history to test
---
-ALTER TABLE "Test" DROP COLUMN "history" CASCADE;
---
--- Create model test_history
---
-DROP TABLE "Test_history" CASCADE;
---
--- Alter field settings on user
---
---
--- Alter field meta on user
---
---
--- Alter field avatar on user
---
---
--- Alter field venue on test
---
---
--- Alter field settings on test
---
---
--- Alter field meta on test
---
---
--- Alter field file on test
---
---
--- Alter field avatar on organization
---
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20201107115450-0027_auto_20201107_0854.js b/apps/_demo/migrations/20201107115450-0027_auto_20201107_0854.js
deleted file mode 100644
index f15745ef..00000000
--- a/apps/_demo/migrations/20201107115450-0027_auto_20201107_0854.js
+++ /dev/null
@@ -1,70 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0027_auto_20201107_0854:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjAtMTEtMDcgMDg6NTQKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKaW1wb3J0IGRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24KCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMjZfYXV0b18yMDIwMTEwNl8yMTQ1JyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkNyZWF0ZU1vZGVsKAogICAgICAgICAgICBuYW1lPSd0ZXN0aXRlbScsCiAgICAgICAgICAgIGZpZWxkcz1bCiAgICAgICAgICAgICAgICAoJ2lkJywgbW9kZWxzLlVVSURGaWVsZChwcmltYXJ5X2tleT1UcnVlLCBzZXJpYWxpemU9RmFsc2UpKSwKICAgICAgICAgICAgICAgICgnbWV0YScsIG1vZGVscy5KU09ORmllbGQoKSksCiAgICAgICAgICAgICAgICAoJ3VwZGF0ZWRBdF91dGMnLCBtb2RlbHMuRGF0ZVRpbWVGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgndXBkYXRlZEF0X29mZnNldCcsIG1vZGVscy5UZXh0RmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSksCiAgICAgICAgICAgICAgICAoJ2NyZWF0ZWRBdF91dGMnLCBtb2RlbHMuRGF0ZVRpbWVGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgnY3JlYXRlZEF0X29mZnNldCcsIG1vZGVscy5UZXh0RmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSksCiAgICAgICAgICAgICAgICAoJ3YnLCBtb2RlbHMuSW50ZWdlckZpZWxkKGRlZmF1bHQ9MSkpLAogICAgICAgICAgICAgICAgKCdjcmVhdGVkQnknLCBtb2RlbHMuRm9yZWlnbktleShibGFuaz1UcnVlLCBkYl9jb2x1bW49J2NyZWF0ZWRCeScsIG51bGw9VHJ1ZSwgb25fZGVsZXRlPWRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24uRE9fTk9USElORywgcmVsYXRlZF9uYW1lPScrJywgdG89J19kamFuZ29fc2NoZW1hLnVzZXInKSksCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgIG9wdGlvbnM9ewogICAgICAgICAgICAgICAgJ2RiX3RhYmxlJzogJ1Rlc3RJdGVtJywKICAgICAgICAgICAgfSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQ3JlYXRlTW9kZWwoCiAgICAgICAgICAgIG5hbWU9J3Rlc3RpdGVtX2hpc3RvcnknLAogIC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VsYXRlZF9uYW1lPScrJywgdG89J19kamFuZ29fc2NoZW1hLnVzZXInKSksCiAgICAgICAgICAgICAgICAoJ2hpc3RvcnlfaWQnLCBtb2RlbHMuRm9yZWlnbktleShibGFuaz1UcnVlLCBkYl9jb2x1bW49J2hpc3RvcnlfaWQnLCBkYl9jb25zdHJhaW50PUZhbHNlLCBvbl9kZWxldGU9ZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbi5ET19OT1RISU5HLCByZWxhdGVkX25hbWU9JysnLCB0bz0nX2RqYW5nb19zY2hlbWEudGVzdGl0ZW0nKSksCiAgICAgICAgICAgICAgICAoJ3Rlc3QnLCBtb2RlbHMuRm9yZWlnbktleShibGFuaz1UcnVlLCBkYl9jb2x1bW49J3Rlc3QnLCBudWxsPVRydWUsIG9uX2RlbGV0ZT1kamFuZ28uZGIubW9kZWxzLmRlbGV0aW9uLkRPX05PVEhJTkcsIHJlbGF0ZWRfbmFtZT0nKycsIHRvPSdfZGphbmdvX3NjaGVtYS50ZXN0JykpLAogICAgICAgICAgICAgICAgKCd1cGRhdGVkQnknLCBtb2RlbHMuRm9yZWlnbktleShibGFuaz1UcnVlLCBkYl9jb2x1bW49J3VwZGF0ZWRCeScsIG51bGw9VHJ1ZSwgb25fZGVsZXRlPWRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24uRE9fTk9USElORywgcmVsYXRlZF9uYW1lPScrJywgdG89J19kamFuZ29fc2NoZW1hLnVzZXInKSksCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgIG9wdGlvbnM9ewogICAgICAgICAgICAgICAgJ2RiX3RhYmxlJzogJ1Rlc3RJdGVtX2hpc3RvcnknLAogICAgICAgICAgICB9LAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BZGRGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdGl0ZW0nLAogICAgICAgICAgICBuYW1lPSdoaXN0b3J5JywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLkZvcmVpZ25LZXkoYmxhbms9VHJ1ZSwgZGJfY29sdW1uPSdoaXN0b3J5JywgbnVsbD1UcnVlLCBvbl9kZWxldGU9ZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbi5ET19OT1RISU5HLCByZWxhdGVkX25hbWU9JysnLCB0bz0nX2RqYW5nb19zY2hlbWEudGVzdGl0ZW1faGlzdG9yeScpLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BZGRGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdGl0ZW0nLAogICAgICAgICAgICBuYW1lPSd0ZXN0JywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLkZvcmVpZ25LZXkoYmxhbms9VHJ1ZSwgZGJfY29sdW1uPSd0ZXN0JywgbnVsbD1UcnVlLCBvbl9kZWxldGU9ZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbi5ET19OT1RISU5HLCByZWxhdGVkX25hbWU9JysnLCB0bz0nX2RqYW5nb19zY2hlbWEudGVzdCcpLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BZGRGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdGl0ZW0nLAogICAgICAgICAgICBuYW1lPSd1cGRhdGVkQnknLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuRm9yZWlnbktleShibGFuaz1UcnVlLCBkYl9jb2x1bW49J3VwZGF0ZWRCeScsIG51bGw9VHJ1ZSwgb25fZGVsZXRlPWRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24uRE9fTk9USElORywgcmVsYXRlZF9uYW1lPScrJywgdG89J19kamFuZ29fc2NoZW1hLnVzZXInKSwKICAgICAgICApLAogICAgXQo=
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Create model testitem
---
-CREATE TABLE "TestItem" ("id" uuid NOT NULL PRIMARY KEY, "meta" jsonb NOT NULL, "updatedAt_utc" timestamp with time zone NULL, "updatedAt_offset" text NULL, "createdAt_utc" timestamp with time zone NULL, "createdAt_offset" text NULL, "v" integer NOT NULL, "createdBy" integer NULL);
---
--- Create model testitem_history
---
-CREATE TABLE "TestItem_history" ("id" uuid NOT NULL PRIMARY KEY, "meta" jsonb NOT NULL, "updatedAt_utc" timestamp with time zone NULL, "updatedAt_offset" text NULL, "createdAt_utc" timestamp with time zone NULL, "createdAt_offset" text NULL, "v" integer NOT NULL, "history_date" timestamp with time zone NOT NULL, "history_action" varchar(50) NOT NULL, "createdBy" integer NULL, "history_id" uuid NOT NULL, "test" integer NULL, "updatedBy" integer NULL);
---
--- Add field history to testitem
---
-ALTER TABLE "TestItem" ADD COLUMN "history" uuid NULL CONSTRAINT "TestItem_history_2c0abe62_fk_TestItem_history_id" REFERENCES "TestItem_history"("id") DEFERRABLE INITIALLY DEFERRED; SET CONSTRAINTS "TestItem_history_2c0abe62_fk_TestItem_history_id" IMMEDIATE;
---
--- Add field test to testitem
---
-ALTER TABLE "TestItem" ADD COLUMN "test" integer NULL CONSTRAINT "TestItem_test_d1b058a0_fk_Test_id" REFERENCES "Test"("id") DEFERRABLE INITIALLY DEFERRED; SET CONSTRAINTS "TestItem_test_d1b058a0_fk_Test_id" IMMEDIATE;
---
--- Add field updatedBy to testitem
---
-ALTER TABLE "TestItem" ADD COLUMN "updatedBy" integer NULL CONSTRAINT "TestItem_updatedBy_558634fb_fk_User_id" REFERENCES "User"("id") DEFERRABLE INITIALLY DEFERRED; SET CONSTRAINTS "TestItem_updatedBy_558634fb_fk_User_id" IMMEDIATE;
-ALTER TABLE "TestItem" ADD CONSTRAINT "TestItem_createdBy_b1354bc6_fk_User_id" FOREIGN KEY ("createdBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-CREATE INDEX "TestItem_createdBy_b1354bc6" ON "TestItem" ("createdBy");
-ALTER TABLE "TestItem_history" ADD CONSTRAINT "TestItem_history_createdBy_5b707bba_fk_User_id" FOREIGN KEY ("createdBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "TestItem_history" ADD CONSTRAINT "TestItem_history_test_e0a8595c_fk_Test_id" FOREIGN KEY ("test") REFERENCES "Test" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "TestItem_history" ADD CONSTRAINT "TestItem_history_updatedBy_040e3544_fk_User_id" FOREIGN KEY ("updatedBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-CREATE INDEX "TestItem_history_createdBy_5b707bba" ON "TestItem_history" ("createdBy");
-CREATE INDEX "TestItem_history_history_id_649f4551" ON "TestItem_history" ("history_id");
-CREATE INDEX "TestItem_history_test_e0a8595c" ON "TestItem_history" ("test");
-CREATE INDEX "TestItem_history_updatedBy_040e3544" ON "TestItem_history" ("updatedBy");
-CREATE INDEX "TestItem_history_2c0abe62" ON "TestItem" ("history");
-CREATE INDEX "TestItem_test_d1b058a0" ON "TestItem" ("test");
-CREATE INDEX "TestItem_updatedBy_558634fb" ON "TestItem" ("updatedBy");
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Add field updatedBy to testitem
---
-ALTER TABLE "TestItem" DROP COLUMN "updatedBy" CASCADE;
---
--- Add field test to testitem
---
-ALTER TABLE "TestItem" DROP COLUMN "test" CASCADE;
---
--- Add field history to testitem
---
-ALTER TABLE "TestItem" DROP COLUMN "history" CASCADE;
---
--- Create model testitem_history
---
-DROP TABLE "TestItem_history" CASCADE;
---
--- Create model testitem
---
-DROP TABLE "TestItem" CASCADE;
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20201108125508-0028_auto_20201108_0955.js b/apps/_demo/migrations/20201108125508-0028_auto_20201108_0955.js
deleted file mode 100644
index 629c76f7..00000000
--- a/apps/_demo/migrations/20201108125508-0028_auto_20201108_0955.js
+++ /dev/null
@@ -1,112 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0028_auto_20201108_0955:IyBHZW5lcmF0ZWQgYnkgRGphbmdvID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wgbnVsbD1UcnVlKSksCiAgICAgICAgICAgICAgICAoJ21ldGEnLCBtb2RlbHMuSlNPTkZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCd0ZXh0JywgbW9kZWxzLlRleHRGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgndXBkYXRlZEF0X3V0YycsIG1vZGVscy5EYXRlVGltZUZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCd1cGRhdGVkQXRfb2Zmc2V0JywgbW9kZWxzLlRleHRGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgnY3JlYXRlZEF0X3V0YycsIG1vZGVscy5EYXRlVGltZUZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCdjcmVhdGVkQXRfb2Zmc2V0JywgbW9kZWxzLlRleHRGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgndicsIG1vZGVscy5JbnRlZ2VyRmllbGQoZGVmYXVsdD0xKSksCiAgICAgICAgICAgICAgICAoJ2lkJywgbW9kZWxzLlVVSURGaWVsZChwcmltYXJ5X2tleT1UcnVlLCBzZXJpYWxpemU9RmFsc2UpKSwKICAgICAgICAgICAgICAgICgnaGlzdG9yeV9kYXRlJywgbW9kZWxzLkRhdGVUaW1lRmllbGQoKSksCiAgICAgICAgICAgICAgICAoJ2hpc3RvcnlfYWN0aW9uJywgbW9kZWxzLkNoYXJGaWVsZChjaG9pY2VzPVsoJ2MnLCAnYycpLCAoJ3UnLCAndScpLCAoJ2QnLCAnZCcpXSwgbWF4X2xlbmd0aD01MCkpLAogICAgICAgICAgICAgICAgKCdjcmVhdGVkQnknLCBtb2RlbHMuRm9yZWlnbktleShibGFuaz1UcnVlLCBkYl9jb2x1bW49J2NyZWF0ZWRCeScsIG51bGw9VHJ1ZSwgb25fZGVsZXRlPWRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24uRE9fTk9USElORywgcmVsYXRlZF9uYW1lPScrJywgdG89J19kamFuZ29fc2NoZW1hLnVzZXInKSksCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgIG9wdGlvbnM9ewogICAgICAgICAgICAgICAgJ2RiX3RhYmxlJzogJ1Rlc3RIaXN0b3J5UmVjb3JkJywKICAgICAgICAgICAgfSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuUmVuYW1lTW9kZWwoCiAgICAgICAgICAgIG9sZF9uYW1lPSd0ZXN0aXRlbV9oaXN0b3J5JywKICAgICAgICAgICAgbmV3X25hbWU9J3Rlc3RpdGVtaGlzdG9yeXJlY29yZCcsCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLlJlbW92ZUZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd0ZXN0JywKICAgICAgICAgICAgbmFtZT0naGlzdG9yeScsCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLlJlbW92ZUZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd0ZXN0aXRlbScsCiAgICAgICAgICAgIG5hbWU9J2hpc3RvcnknLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BbHRlckZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd0ZXN0JywKICAgICAgICAgICAgbmFtZT0nc3RhdHVzX3JlbmFtZWQnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuQ2hhckZpZWxkKGNob2ljZXM9WygncGVuZGluZycsICdwZW5kaW5nJyksICgncHJvY2Vzc2VkJywgJ3Byb2Nlc3NlZCcpLCAoJ25vJywgJ25vJyldLCBtYXhfbGVuZ3RoPTUwKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWx0ZXJNb2RlbFRhYmxlKAogICAgICAgICAgICBuYW1lPSd0Z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5JywgbnVsbD1UcnVlLCBvbl9kZWxldGU9ZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbi5ET19OT1RISU5HLCByZWxhdGVkX25hbWU9JysnLCB0bz0nX2RqYW5nb19zY2hlbWEudXNlcicpLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5EZWxldGVNb2RlbCgKICAgICAgICAgICAgbmFtZT0ndGVzdF9oaXN0b3J5JywKICAgICAgICApLAogICAgXQo=
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Create model testhistoryrecord
---
-CREATE TABLE "TestHistoryRecord" ("date1_utc" timestamp with time zone NULL, "date1_offset" text NULL, "utc" timestamp with time zone NULL, "day" date NULL, "file" jsonb NULL, "pass" varchar(60) NULL, "heroColor" text NULL, "isEnabled" boolean NOT NULL, "rating1" integer NOT NULL, "rating2" numeric(8, 2) NULL, "rating3" numeric(18, 4) NULL, "venue" jsonb NULL, "status_renamed" varchar(50) NOT NULL, "uuid" uuid NOT NULL, "url" text NOT NULL, "slug" text NOT NULL UNIQUE, "rating" integer NULL, "settings" jsonb NULL, "meta" jsonb NULL, "text" text NULL, "updatedAt_utc" timestamp with time zone NULL, "updatedAt_offset" text NULL, "createdAt_utc" timestamp with time zone NULL, "createdAt_offset" text NULL, "v" integer NOT NULL, "id" uuid NOT NULL PRIMARY KEY, "history_date" timestamp with time zone NOT NULL, "history_action" varchar(50) NOT NULL, "createdBy" integer NULL);
---
--- Rename model testitem_history to testitemhistoryrecord
---
---
--- Remove field history from test
---
-SET CONSTRAINTS "Test_history_6cd5696d_fk_Test_history_id" IMMEDIATE; ALTER TABLE "Test" DROP CONSTRAINT "Test_history_6cd5696d_fk_Test_history_id";
-ALTER TABLE "Test" DROP COLUMN "history" CASCADE;
---
--- Remove field history from testitem
---
-SET CONSTRAINTS "TestItem_history_2c0abe62_fk_TestItem_history_id" IMMEDIATE; ALTER TABLE "TestItem" DROP CONSTRAINT "TestItem_history_2c0abe62_fk_TestItem_history_id";
-ALTER TABLE "TestItem" DROP COLUMN "history" CASCADE;
---
--- Alter field status_renamed on test
---
---
--- Rename table for testitemhistoryrecord to TestItemHistoryRecord
---
-ALTER TABLE "TestItem_history" RENAME TO "TestItemHistoryRecord";
---
--- Add field history_id to testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" ADD COLUMN "history_id" integer NOT NULL;
---
--- Add field self to testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" ADD COLUMN "self" integer NULL CONSTRAINT "TestHistoryRecord_self_d09f530b_fk_Test_id" REFERENCES "Test"("id") DEFERRABLE INITIALLY DEFERRED; SET CONSTRAINTS "TestHistoryRecord_self_d09f530b_fk_Test_id" IMMEDIATE;
---
--- Add field updatedBy to testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" ADD COLUMN "updatedBy" integer NULL CONSTRAINT "TestHistoryRecord_updatedBy_8429de21_fk_User_id" REFERENCES "User"("id") DEFERRABLE INITIALLY DEFERRED; SET CONSTRAINTS "TestHistoryRecord_updatedBy_8429de21_fk_User_id" IMMEDIATE;
---
--- Delete model test_history
---
-DROP TABLE "Test_history" CASCADE;
-ALTER TABLE "TestHistoryRecord" ADD CONSTRAINT "TestHistoryRecord_createdBy_85dfb4aa_fk_User_id" FOREIGN KEY ("createdBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-CREATE INDEX "TestHistoryRecord_slug_25daa18b_like" ON "TestHistoryRecord" ("slug" text_pattern_ops);
-CREATE INDEX "TestHistoryRecord_createdBy_85dfb4aa" ON "TestHistoryRecord" ("createdBy");
-CREATE INDEX "TestHistoryRecord_history_id_9e99b381" ON "TestHistoryRecord" ("history_id");
-CREATE INDEX "TestHistoryRecord_self_d09f530b" ON "TestHistoryRecord" ("self");
-CREATE INDEX "TestHistoryRecord_updatedBy_8429de21" ON "TestHistoryRecord" ("updatedBy");
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Delete model test_history
---
-CREATE TABLE "Test_history" ("date1_utc" timestamp with time zone NULL, "date1_offset" text NULL, "utc" timestamp with time zone NULL, "day" date NULL, "file" jsonb NULL, "pass" varchar(60) NULL, "heroColor" text NULL, "isEnabled" boolean NOT NULL, "rating1" integer NOT NULL, "rating2" numeric(8, 2) NULL, "rating3" numeric(18, 4) NULL, "venue" jsonb NULL, "status_renamed" varchar(50) NOT NULL, "uuid" uuid NOT NULL, "url" text NOT NULL, "slug" text NOT NULL UNIQUE, "rating" integer NULL, "settings" jsonb NULL, "meta" jsonb NULL, "text" text NULL, "updatedAt_utc" timestamp with time zone NULL, "updatedAt_offset" text NULL, "createdAt_utc" timestamp with time zone NULL, "createdAt_offset" text NULL, "v" integer NOT NULL, "id" uuid NOT NULL PRIMARY KEY, "history_date" timestamp with time zone NOT NULL, "history_action" varchar(50) NOT NULL, "createdBy" integer NULL, "history_id" integer NOT NULL, "self" integer NULL, "updatedBy" integer NULL);
---
--- Add field updatedBy to testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" DROP COLUMN "updatedBy" CASCADE;
---
--- Add field self to testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" DROP COLUMN "self" CASCADE;
---
--- Add field history_id to testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" DROP COLUMN "history_id" CASCADE;
---
--- Rename table for testitemhistoryrecord to TestItemHistoryRecord
---
-ALTER TABLE "TestItemHistoryRecord" RENAME TO "TestItem_history";
---
--- Alter field status_renamed on test
---
---
--- Remove field history from testitem
---
-ALTER TABLE "TestItem" ADD COLUMN "history" uuid NULL CONSTRAINT "TestItem_history_2c0abe62_fk_TestItem_history_id" REFERENCES "TestItem_history"("id") DEFERRABLE INITIALLY DEFERRED; SET CONSTRAINTS "TestItem_history_2c0abe62_fk_TestItem_history_id" IMMEDIATE;
---
--- Remove field history from test
---
-ALTER TABLE "Test" ADD COLUMN "history" uuid NULL CONSTRAINT "Test_history_6cd5696d_fk_Test_history_id" REFERENCES "Test_history"("id") DEFERRABLE INITIALLY DEFERRED; SET CONSTRAINTS "Test_history_6cd5696d_fk_Test_history_id" IMMEDIATE;
---
--- Rename model testitem_history to testitemhistoryrecord
---
---
--- Create model testhistoryrecord
---
-DROP TABLE "TestHistoryRecord" CASCADE;
-ALTER TABLE "Test_history" ADD CONSTRAINT "Test_history_createdBy_a50667f1_fk_User_id" FOREIGN KEY ("createdBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "Test_history" ADD CONSTRAINT "Test_history_self_99994f16_fk_Test_id" FOREIGN KEY ("self") REFERENCES "Test" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "Test_history" ADD CONSTRAINT "Test_history_updatedBy_1ad3a91d_fk_User_id" FOREIGN KEY ("updatedBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-CREATE INDEX "Test_history_slug_55ce7738_like" ON "Test_history" ("slug" text_pattern_ops);
-CREATE INDEX "Test_history_createdBy_a50667f1" ON "Test_history" ("createdBy");
-CREATE INDEX "Test_history_history_id_6cc6b594" ON "Test_history" ("history_id");
-CREATE INDEX "Test_history_self_99994f16" ON "Test_history" ("self");
-CREATE INDEX "Test_history_updatedBy_1ad3a91d" ON "Test_history" ("updatedBy");
-CREATE INDEX "TestItem_history_2c0abe62" ON "TestItem" ("history");
-CREATE INDEX "Test_history_6cd5696d" ON "Test" ("history");
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20201108185916-0029_auto_20201108_1559.js b/apps/_demo/migrations/20201108185916-0029_auto_20201108_1559.js
deleted file mode 100644
index d966b3ac..00000000
--- a/apps/_demo/migrations/20201108185916-0029_auto_20201108_1559.js
+++ /dev/null
@@ -1,34 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0029_auto_20201108_1559:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjAtMTEtMDggMTU6NTkKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMjhfYXV0b18yMDIwMTEwOF8wOTU1JyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkFkZEZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd0ZXN0JywKICAgICAgICAgICAgbmFtZT0nbWV0YVN0cmluZycsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5KU09ORmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWRkRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3RoaXN0b3J5cmVjb3JkJywKICAgICAgICAgICAgbmFtZT0nbWV0YVN0cmluZycsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5KU09ORmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgXQo=
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Add field metaString to test
---
-ALTER TABLE "Test" ADD COLUMN "metaString" jsonb NULL;
---
--- Add field metaString to testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" ADD COLUMN "metaString" jsonb NULL;
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Add field metaString to testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" DROP COLUMN "metaString" CASCADE;
---
--- Add field metaString to test
---
-ALTER TABLE "Test" DROP COLUMN "metaString" CASCADE;
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20201109003437-0030_auto_20201108_2134.js b/apps/_demo/migrations/20201109003437-0030_auto_20201108_2134.js
deleted file mode 100644
index 1be79b5e..00000000
--- a/apps/_demo/migrations/20201109003437-0030_auto_20201108_2134.js
+++ /dev/null
@@ -1,116 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0030_auto_20201108_2134:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjAtMTEtMDggMjE6MzQKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMjlfYXV0b18yMDIwMTEwOF8xNTU5JyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkFkZEZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd0ZXN0aGlzdG9yeXJlY29yZCcsCiAgICAgICAgICAgIG5hbWU9J3ZpcjEnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuSlNPTkZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3RoaXN0b3J5cmVjb3JkJywKICAgICAgICAgICAgbmFtZT0naXNFbmFibGVkJywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLkJvb2xlYW5GaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BbHRlckZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd0ZXN0aGlzdG9yeXJlY29yZCcsCiAgICAgICAgICAgIG5hbWU9J3Bhc3NfZmllbGQnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuVGV4dEZpZWxkKGJsYW5rPVRydWUsIGRiX2NvbHVtbj0ncGFzcycsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3RoaXN0b3J5cmVjb3JkJywKICAgICAgICAgICAgbmFtZT0ncmF0aW5nMScsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5JbnRlZ2VyRmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWx0ZXJGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdGhpc3RvcnlyZWNvcmQnLAogICAgICAgICAgICBuYW1lPSdzbHVnJywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLlRleHRGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BbHRlckZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd0ZXN0aGlzdG9yeXJlY29yZCcsCiAgICAgICAgICAgIG5hbWU9J3N0YXR1c19yZW5hbWVkJywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLlRleHRGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BbHRlckZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd0ZXN0aGlzdG9yeXJlY29yZCcsCiAgICAgICAgICAgIG5hbWU9J3VybCcsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5UZXh0RmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWx0ZXJGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdGhpc3RvcnlyZWNvcmQnLAogICAgICAgICAgICBuYW1lPSd1dWlkJywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLlVVSURGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BbHRlckZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd0ZXN0aGlzdG9yeXJlY29yZCcsCiAgICAgICAgICAgIG5hbWU9J3YnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuSW50ZWdlckZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3RpdGVtaGlzdG9yeXJlY29yZCcsCiAgICAgICAgICAgIG5hbWU9J21ldGEnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuSlNPTkZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3RpdGVtaGlzdG9yeXJlY29yZCcsCiAgICAgICAgICAgIG5hbWU9J3YnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuSW50ZWdlckZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgIF0K
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Add field vir1 to testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" ADD COLUMN "vir1" jsonb NULL;
---
--- Alter field isEnabled on testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" ALTER COLUMN "isEnabled" DROP NOT NULL;
---
--- Alter field pass_field on testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" ALTER COLUMN "pass" TYPE text USING "pass"::text;
---
--- Alter field rating1 on testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" ALTER COLUMN "rating1" DROP NOT NULL;
---
--- Alter field slug on testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" DROP CONSTRAINT "TestHistoryRecord_slug_key";
-ALTER TABLE "TestHistoryRecord" ALTER COLUMN "slug" DROP NOT NULL;
-DROP INDEX IF EXISTS "TestHistoryRecord_slug_25daa18b_like";
---
--- Alter field status_renamed on testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" ALTER COLUMN "status_renamed" TYPE text USING "status_renamed"::text, ALTER COLUMN "status_renamed" DROP NOT NULL;
---
--- Alter field url on testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" ALTER COLUMN "url" DROP NOT NULL;
---
--- Alter field uuid on testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" ALTER COLUMN "uuid" DROP NOT NULL;
---
--- Alter field v on testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" ALTER COLUMN "v" DROP NOT NULL;
---
--- Alter field meta on testitemhistoryrecord
---
-ALTER TABLE "TestItemHistoryRecord" ALTER COLUMN "meta" DROP NOT NULL;
---
--- Alter field v on testitemhistoryrecord
---
-ALTER TABLE "TestItemHistoryRecord" ALTER COLUMN "v" DROP NOT NULL;
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Alter field v on testitemhistoryrecord
---
-ALTER TABLE "TestItemHistoryRecord" ALTER COLUMN "v" SET DEFAULT 1;
-UPDATE "TestItemHistoryRecord" SET "v" = 1 WHERE "v" IS NULL;
-ALTER TABLE "TestItemHistoryRecord" ALTER COLUMN "v" SET NOT NULL;
-ALTER TABLE "TestItemHistoryRecord" ALTER COLUMN "v" DROP DEFAULT;
---
--- Alter field meta on testitemhistoryrecord
---
-ALTER TABLE "TestItemHistoryRecord" ALTER COLUMN "meta" SET NOT NULL;
---
--- Alter field v on testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" ALTER COLUMN "v" SET DEFAULT 1;
-UPDATE "TestHistoryRecord" SET "v" = 1 WHERE "v" IS NULL;
-ALTER TABLE "TestHistoryRecord" ALTER COLUMN "v" SET NOT NULL;
-ALTER TABLE "TestHistoryRecord" ALTER COLUMN "v" DROP DEFAULT;
---
--- Alter field uuid on testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" ALTER COLUMN "uuid" SET NOT NULL;
---
--- Alter field url on testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" ALTER COLUMN "url" SET NOT NULL;
---
--- Alter field status_renamed on testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" ALTER COLUMN "status_renamed" TYPE varchar(50) USING "status_renamed"::varchar(50), ALTER COLUMN "status_renamed" SET NOT NULL;
---
--- Alter field slug on testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" ALTER COLUMN "slug" SET NOT NULL;
-ALTER TABLE "TestHistoryRecord" ADD CONSTRAINT "TestHistoryRecord_slug_25daa18b_uniq" UNIQUE ("slug");
-CREATE INDEX "TestHistoryRecord_slug_25daa18b_like" ON "TestHistoryRecord" ("slug" text_pattern_ops);
---
--- Alter field rating1 on testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" ALTER COLUMN "rating1" SET NOT NULL;
---
--- Alter field pass_field on testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" ALTER COLUMN "pass" TYPE varchar(60) USING "pass"::varchar(60);
---
--- Alter field isEnabled on testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" ALTER COLUMN "isEnabled" SET NOT NULL;
---
--- Add field vir1 to testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" DROP COLUMN "vir1" CASCADE;
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20201109010114-0031_auto_20201108_2201.js b/apps/_demo/migrations/20201109010114-0031_auto_20201108_2201.js
deleted file mode 100644
index 082d1954..00000000
--- a/apps/_demo/migrations/20201109010114-0031_auto_20201108_2201.js
+++ /dev/null
@@ -1,48 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0031_auto_20201108_2201:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjAtMTEtMDggMjI6MDEKCmZyb20gZGphbmdvLmRiIG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ports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Delete model testitemhistoryrecord
---
-DROP TABLE "TestItemHistoryRecord" CASCADE;
---
--- Delete model testhistoryrecord
---
-DROP TABLE "TestHistoryRecord" CASCADE;
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Delete model testhistoryrecord
---
-CREATE TABLE "TestHistoryRecord" ("date1_utc" timestamp with time zone NULL, "date1_offset" text NULL, "utc" timestamp with time zone NULL, "day" date NULL, "file" jsonb NULL, "pass" text NULL, "heroColor" text NULL, "isEnabled" boolean NULL, "rating1" integer NULL, "rating2" numeric(8, 2) NULL, "rating3" numeric(18, 4) NULL, "venue" jsonb NULL, "status_renamed" text NULL, "uuid" uuid NULL, "url" text NULL, "slug" text NULL, "rating" integer NULL, "settings" jsonb NULL, "meta" jsonb NULL, "text" text NULL, "updatedAt_utc" timestamp with time zone NULL, "updatedAt_offset" text NULL, "createdAt_utc" timestamp with time zone NULL, "createdAt_offset" text NULL, "v" integer NULL, "id" uuid NOT NULL PRIMARY KEY, "history_date" timestamp with time zone NOT NULL, "history_action" varchar(50) NOT NULL, "createdBy" integer NULL, "history_id" integer NOT NULL, "self" integer NULL, "updatedBy" integer NULL, "metaString" jsonb NULL, "vir1" jsonb NULL);
---
--- Delete model testitemhistoryrecord
---
-CREATE TABLE "TestItemHistoryRecord" ("id" uuid NOT NULL PRIMARY KEY, "meta" jsonb NULL, "updatedAt_utc" timestamp with time zone NULL, "updatedAt_offset" text NULL, "createdAt_utc" timestamp with time zone NULL, "createdAt_offset" text NULL, "v" integer NULL, "history_date" timestamp with time zone NOT NULL, "history_action" varchar(50) NOT NULL, "createdBy" integer NULL, "history_id" uuid NOT NULL, "test" integer NULL, "updatedBy" integer NULL);
-ALTER TABLE "TestHistoryRecord" ADD CONSTRAINT "TestHistoryRecord_createdBy_85dfb4aa_fk_User_id" FOREIGN KEY ("createdBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "TestHistoryRecord" ADD CONSTRAINT "TestHistoryRecord_self_d09f530b_fk_Test_id" FOREIGN KEY ("self") REFERENCES "Test" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "TestHistoryRecord" ADD CONSTRAINT "TestHistoryRecord_updatedBy_8429de21_fk_User_id" FOREIGN KEY ("updatedBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-CREATE INDEX "TestHistoryRecord_createdBy_85dfb4aa" ON "TestHistoryRecord" ("createdBy");
-CREATE INDEX "TestHistoryRecord_history_id_9e99b381" ON "TestHistoryRecord" ("history_id");
-CREATE INDEX "TestHistoryRecord_self_d09f530b" ON "TestHistoryRecord" ("self");
-CREATE INDEX "TestHistoryRecord_updatedBy_8429de21" ON "TestHistoryRecord" ("updatedBy");
-ALTER TABLE "TestItemHistoryRecord" ADD CONSTRAINT "TestItemHistoryRecord_createdBy_0d7982dc_fk_User_id" FOREIGN KEY ("createdBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "TestItemHistoryRecord" ADD CONSTRAINT "TestItemHistoryRecord_test_4500e1e7_fk_Test_id" FOREIGN KEY ("test") REFERENCES "Test" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "TestItemHistoryRecord" ADD CONSTRAINT "TestItemHistoryRecord_updatedBy_aed0bd7a_fk_User_id" FOREIGN KEY ("updatedBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-CREATE INDEX "TestItemHistoryRecord_createdBy_0d7982dc" ON "TestItemHistoryRecord" ("createdBy");
-CREATE INDEX "TestItemHistoryRecord_history_id_3e2881da" ON "TestItemHistoryRecord" ("history_id");
-CREATE INDEX "TestItemHistoryRecord_test_4500e1e7" ON "TestItemHistoryRecord" ("test");
-CREATE INDEX "TestItemHistoryRecord_updatedBy_aed0bd7a" ON "TestItemHistoryRecord" ("updatedBy");
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20201109010208-0032_testhistoryrecord_testitemhistoryrecord.js b/apps/_demo/migrations/20201109010208-0032_testhistoryrecord_testitemhistoryrecord.js
deleted file mode 100644
index a49176e7..00000000
--- a/apps/_demo/migrations/20201109010208-0032_testhistoryrecord_testitemhistoryrecord.js
+++ /dev/null
@@ -1,48 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0032_testhistoryrecord_testitemhistoryrecord:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjAtMTEtMDggMjI6MDIKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKaW1wb3J0IGRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24KCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMzFfYXV0b18yMDIwMTEwOF8yMjAxJyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkNyZWF0ZU1vZGVsKAogICAgICAgICAgICBuYW1lPSd0ZXN0aXRlbWhpc3RvcnlyZWNvcmQnLAogICAgICAgICAgICBmaWVsZHM9WwogICAgICAgICAgICAgICAgKCdpZCcsIG1vZGVscy5VVUlERmllbGQocHJpbWFyeV9rZXk9VHJ1ZSwgc2VyaWFsaXplPUZhbHNlKSksCiAgICAgICAgICAgICAgICAoJ21ldGEnLCBtb2RlbHMuSlNPTkZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCd1cGRhdGVkQXRfdXRjJywgbW9kZWxzLkRhdGVUaW1lRmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSksCiAgICAgICAgICAgICAgICAoJ3VwZGF0ZWRBdF9vZmZzZXQnLCBtb2RlbHMuVGV4dEZpZWxkKGJsYW5rPV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ICAgICAgICAgICgnZmlsZScsIG1vZGVscy5KU09ORmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSksCiAgICAgICAgICAgICAgICAoJ3Bhc3NfZmllbGQnLCBtb2RlbHMuVGV4dEZpZWxkKGJsYW5rPVRydWUsIGRiX2NvbHVtbj0ncGFzcycsIG51bGw9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCd2aXIxJywgbW9kZWxzLkpTT05GaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgnaGVyb0NvbG9yJywgbW9kZWxzLlRleHRGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgnaXNFbmFibGVkJywgbW9kZWxzLkJvb2xlYW5GaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgncmF0aW5nMScsIG1vZGVscy5JbnRlZ2VyRmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSksCiAgICAgICAgICAgICAgICAoJ3JhdGluZzInLCBtb2RlbHMuRGVjaW1hbEZpZWxkKGJsYW5rPVRydWUsIGRlY2ltYWxfcGxhY2VzPTIsIG1heF9kaWdpdHM9OCwgbnVsbD1UcnVlKSksCiAgICAgICAgICAgICAgICAoJ3JhdGluZzMnLCBtb2RlbHMuRGVjaW1hbEZpZWxkKGJsYW5rPVRydWUsIGRlY2ltYWxfcGxhY2VzPTQsIG1heF9kaWdpdHM9MTgsIG51bGw9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCd2ZW51ZScsIG1vZGVscy5KU09ORmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSksCiAgICAgICAgICAgICAgICAoJ3N0YXR1c19yZW5hbWVkJywgbW9kZWxzLlRleHRGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgndXVpZCcsIG1vZGVscy5VVUlERmllbGQoYmxhbms9VHJ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FtZT0nKycsIHRvPSdfZGphbmdvX3NjaGVtYS50ZXN0JykpLAogICAgICAgICAgICAgICAgKCd1cGRhdGVkQnknLCBtb2RlbHMuRm9yZWlnbktleShibGFuaz1UcnVlLCBkYl9jb2x1bW49J3VwZGF0ZWRCeScsIG51bGw9VHJ1ZSwgb25fZGVsZXRlPWRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24uRE9fTk9USElORywgcmVsYXRlZF9uYW1lPScrJywgdG89J19kamFuZ29fc2NoZW1hLnVzZXInKSksCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgIG9wdGlvbnM9ewogICAgICAgICAgICAgICAgJ2RiX3RhYmxlJzogJ1Rlc3RIaXN0b3J5UmVjb3JkJywKICAgICAgICAgICAgfSwKICAgICAgICApLAogICAgXQo=
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Create model testitemhistoryrecord
---
-CREATE TABLE "TestItemHistoryRecord" ("id" uuid NOT NULL PRIMARY KEY, "meta" jsonb NULL, "updatedAt_utc" timestamp with time zone NULL, "updatedAt_offset" text NULL, "createdAt_utc" timestamp with time zone NULL, "createdAt_offset" text NULL, "v" integer NULL, "history_date" timestamp with time zone NOT NULL, "history_action" varchar(50) NOT NULL, "createdBy" integer NULL, "history_id" uuid NOT NULL, "test" integer NULL, "updatedBy" integer NULL);
---
--- Create model testhistoryrecord
---
-CREATE TABLE "TestHistoryRecord" ("date1_utc" timestamp with time zone NULL, "date1_offset" text NULL, "utc" timestamp with time zone NULL, "day" date NULL, "file" jsonb NULL, "pass" text NULL, "vir1" jsonb NULL, "heroColor" text NULL, "isEnabled" boolean NULL, "rating1" integer NULL, "rating2" numeric(8, 2) NULL, "rating3" numeric(18, 4) NULL, "venue" jsonb NULL, "status_renamed" text NULL, "uuid" uuid NULL, "url" text NULL, "slug" text NULL, "rating" integer NULL, "settings" jsonb NULL, "meta" jsonb NULL, "metaString" jsonb NULL, "text" text NULL, "updatedAt_utc" timestamp with time zone NULL, "updatedAt_offset" text NULL, "createdAt_utc" timestamp with time zone NULL, "createdAt_offset" text NULL, "v" integer NULL, "id" uuid NOT NULL PRIMARY KEY, "history_date" timestamp with time zone NOT NULL, "history_action" varchar(50) NOT NULL, "createdBy" integer NULL, "history_id" integer NOT NULL, "self" integer NULL, "updatedBy" integer NULL);
-ALTER TABLE "TestItemHistoryRecord" ADD CONSTRAINT "TestItemHistoryRecord_createdBy_0d7982dc_fk_User_id" FOREIGN KEY ("createdBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "TestItemHistoryRecord" ADD CONSTRAINT "TestItemHistoryRecord_test_4500e1e7_fk_Test_id" FOREIGN KEY ("test") REFERENCES "Test" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "TestItemHistoryRecord" ADD CONSTRAINT "TestItemHistoryRecord_updatedBy_aed0bd7a_fk_User_id" FOREIGN KEY ("updatedBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-CREATE INDEX "TestItemHistoryRecord_createdBy_0d7982dc" ON "TestItemHistoryRecord" ("createdBy");
-CREATE INDEX "TestItemHistoryRecord_history_id_3e2881da" ON "TestItemHistoryRecord" ("history_id");
-CREATE INDEX "TestItemHistoryRecord_test_4500e1e7" ON "TestItemHistoryRecord" ("test");
-CREATE INDEX "TestItemHistoryRecord_updatedBy_aed0bd7a" ON "TestItemHistoryRecord" ("updatedBy");
-ALTER TABLE "TestHistoryRecord" ADD CONSTRAINT "TestHistoryRecord_createdBy_85dfb4aa_fk_User_id" FOREIGN KEY ("createdBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "TestHistoryRecord" ADD CONSTRAINT "TestHistoryRecord_self_d09f530b_fk_Test_id" FOREIGN KEY ("self") REFERENCES "Test" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "TestHistoryRecord" ADD CONSTRAINT "TestHistoryRecord_updatedBy_8429de21_fk_User_id" FOREIGN KEY ("updatedBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-CREATE INDEX "TestHistoryRecord_createdBy_85dfb4aa" ON "TestHistoryRecord" ("createdBy");
-CREATE INDEX "TestHistoryRecord_history_id_9e99b381" ON "TestHistoryRecord" ("history_id");
-CREATE INDEX "TestHistoryRecord_self_d09f530b" ON "TestHistoryRecord" ("self");
-CREATE INDEX "TestHistoryRecord_updatedBy_8429de21" ON "TestHistoryRecord" ("updatedBy");
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Create model testhistoryrecord
---
-DROP TABLE "TestHistoryRecord" CASCADE;
---
--- Create model testitemhistoryrecord
---
-DROP TABLE "TestItemHistoryRecord" CASCADE;
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20201109010711-0033_auto_20201108_2207.js b/apps/_demo/migrations/20201109010711-0033_auto_20201108_2207.js
deleted file mode 100644
index f98ac1ca..00000000
--- a/apps/_demo/migrations/20201109010711-0033_auto_20201108_2207.js
+++ /dev/null
@@ -1,78 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0033_auto_20201108_2207:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjAtMTEtMDggMjI6MDcKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKaW1wb3J0IGRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24KCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMzJfdGVzdGhpc3RvcnlyZWNvcmRfdGVzdGl0ZW1oaXN0b3J5cmVjb3JkJyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3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YXRlZEJ5JywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLkZvcmVpZ25LZXkoYmxhbms9VHJ1ZSwgZGJfY29sdW1uPSd1cGRhdGVkQnknLCBkYl9jb25zdHJhaW50PUZhbHNlLCBkYl9pbmRleD1GYWxzZSwgbnVsbD1UcnVlLCBvbl9kZWxldGU9ZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbi5ET19OT1RISU5HLCByZWxhdGVkX25hbWU9JysnLCB0bz0nX2RqYW5nb19zY2hlbWEudXNlcicpLAogICAgICAgICksCiAgICBdCg==
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Alter field createdBy on testhistoryrecord
---
-SET CONSTRAINTS "TestHistoryRecord_createdBy_85dfb4aa_fk_User_id" IMMEDIATE; ALTER TABLE "TestHistoryRecord" DROP CONSTRAINT "TestHistoryRecord_createdBy_85dfb4aa_fk_User_id";
-DROP INDEX IF EXISTS "TestHistoryRecord_createdBy_85dfb4aa";
---
--- Alter field self on testhistoryrecord
---
-SET CONSTRAINTS "TestHistoryRecord_self_d09f530b_fk_Test_id" IMMEDIATE; ALTER TABLE "TestHistoryRecord" DROP CONSTRAINT "TestHistoryRecord_self_d09f530b_fk_Test_id";
-DROP INDEX IF EXISTS "TestHistoryRecord_self_d09f530b";
---
--- Alter field updatedBy on testhistoryrecord
---
-SET CONSTRAINTS "TestHistoryRecord_updatedBy_8429de21_fk_User_id" IMMEDIATE; ALTER TABLE "TestHistoryRecord" DROP CONSTRAINT "TestHistoryRecord_updatedBy_8429de21_fk_User_id";
-DROP INDEX IF EXISTS "TestHistoryRecord_updatedBy_8429de21";
---
--- Alter field createdBy on testitemhistoryrecord
---
-SET CONSTRAINTS "TestItemHistoryRecord_createdBy_0d7982dc_fk_User_id" IMMEDIATE; ALTER TABLE "TestItemHistoryRecord" DROP CONSTRAINT "TestItemHistoryRecord_createdBy_0d7982dc_fk_User_id";
-DROP INDEX IF EXISTS "TestItemHistoryRecord_createdBy_0d7982dc";
---
--- Alter field test on testitemhistoryrecord
---
-SET CONSTRAINTS "TestItemHistoryRecord_test_4500e1e7_fk_Test_id" IMMEDIATE; ALTER TABLE "TestItemHistoryRecord" DROP CONSTRAINT "TestItemHistoryRecord_test_4500e1e7_fk_Test_id";
-DROP INDEX IF EXISTS "TestItemHistoryRecord_test_4500e1e7";
---
--- Alter field updatedBy on testitemhistoryrecord
---
-SET CONSTRAINTS "TestItemHistoryRecord_updatedBy_aed0bd7a_fk_User_id" IMMEDIATE; ALTER TABLE "TestItemHistoryRecord" DROP CONSTRAINT "TestItemHistoryRecord_updatedBy_aed0bd7a_fk_User_id";
-DROP INDEX IF EXISTS "TestItemHistoryRecord_updatedBy_aed0bd7a";
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Alter field updatedBy on testitemhistoryrecord
---
-CREATE INDEX "TestItemHistoryRecord_updatedBy_aed0bd7a" ON "TestItemHistoryRecord" ("updatedBy");
-ALTER TABLE "TestItemHistoryRecord" ADD CONSTRAINT "TestItemHistoryRecord_updatedBy_aed0bd7a_fk_User_id" FOREIGN KEY ("updatedBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
---
--- Alter field test on testitemhistoryrecord
---
-CREATE INDEX "TestItemHistoryRecord_test_4500e1e7" ON "TestItemHistoryRecord" ("test");
-ALTER TABLE "TestItemHistoryRecord" ADD CONSTRAINT "TestItemHistoryRecord_test_4500e1e7_fk_Test_id" FOREIGN KEY ("test") REFERENCES "Test" ("id") DEFERRABLE INITIALLY DEFERRED;
---
--- Alter field createdBy on testitemhistoryrecord
---
-CREATE INDEX "TestItemHistoryRecord_createdBy_0d7982dc" ON "TestItemHistoryRecord" ("createdBy");
-ALTER TABLE "TestItemHistoryRecord" ADD CONSTRAINT "TestItemHistoryRecord_createdBy_0d7982dc_fk_User_id" FOREIGN KEY ("createdBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
---
--- Alter field updatedBy on testhistoryrecord
---
-CREATE INDEX "TestHistoryRecord_updatedBy_8429de21" ON "TestHistoryRecord" ("updatedBy");
-ALTER TABLE "TestHistoryRecord" ADD CONSTRAINT "TestHistoryRecord_updatedBy_8429de21_fk_User_id" FOREIGN KEY ("updatedBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
---
--- Alter field self on testhistoryrecord
---
-CREATE INDEX "TestHistoryRecord_self_d09f530b" ON "TestHistoryRecord" ("self");
-ALTER TABLE "TestHistoryRecord" ADD CONSTRAINT "TestHistoryRecord_self_d09f530b_fk_Test_id" FOREIGN KEY ("self") REFERENCES "Test" ("id") DEFERRABLE INITIALLY DEFERRED;
---
--- Alter field createdBy on testhistoryrecord
---
-CREATE INDEX "TestHistoryRecord_createdBy_85dfb4aa" ON "TestHistoryRecord" ("createdBy");
-ALTER TABLE "TestHistoryRecord" ADD CONSTRAINT "TestHistoryRecord_createdBy_85dfb4aa_fk_User_id" FOREIGN KEY ("createdBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20201110002813-0034_auto_20201109_2128.js b/apps/_demo/migrations/20201110002813-0034_auto_20201109_2128.js
deleted file mode 100644
index aa224209..00000000
--- a/apps/_demo/migrations/20201110002813-0034_auto_20201109_2128.js
+++ /dev/null
@@ -1,77 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0034_auto_20201109_2128:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjAtMTEtMDkgMjE6MjgKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMzNfYXV0b18yMDIwMTEwOF8yMjA3JyksCiAgICBdCgogICAgb3B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5JywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLlBvc2l0aXZlSW50ZWdlckZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3RpdGVtaGlzdG9yeXJlY29yZCcsCiAgICAgICAgICAgIG5hbWU9J2hpc3RvcnlfaWQnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuVVVJREZpZWxkKCksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3RpdGVtaGlzdG9yeXJlY29yZCcsCiAgICAgICAgICAgIG5hbWU9J3Rlc3QnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuUG9zaXRpdmVJbnRlZ2VyRmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWx0ZXJGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdGl0ZW1oaXN0b3J5cmVjb3JkJywKICAgICAgICAgICAgbmFtZT0ndXBkYXRlZEJ5JywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLlBvc2l0aXZlSW50ZWdlckZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgIF0K
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Alter field createdBy on testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" ADD CONSTRAINT "TestHistoryRecord_createdBy_85dfb4aa_check" CHECK ("createdBy" >= 0);
---
--- Alter field history_id on testhistoryrecord
---
-DROP INDEX IF EXISTS "TestHistoryRecord_history_id_9e99b381";
-ALTER TABLE "TestHistoryRecord" ADD CONSTRAINT "TestHistoryRecord_history_id_9e99b381_check" CHECK ("history_id" >= 0);
---
--- Alter field self on testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" ADD CONSTRAINT "TestHistoryRecord_self_d09f530b_check" CHECK ("self" >= 0);
---
--- Alter field updatedBy on testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" ADD CONSTRAINT "TestHistoryRecord_updatedBy_8429de21_check" CHECK ("updatedBy" >= 0);
---
--- Alter field createdBy on testitemhistoryrecord
---
-ALTER TABLE "TestItemHistoryRecord" ADD CONSTRAINT "TestItemHistoryRecord_createdBy_0d7982dc_check" CHECK ("createdBy" >= 0);
---
--- Alter field history_id on testitemhistoryrecord
---
-DROP INDEX IF EXISTS "TestItemHistoryRecord_history_id_3e2881da";
---
--- Alter field test on testitemhistoryrecord
---
-ALTER TABLE "TestItemHistoryRecord" ADD CONSTRAINT "TestItemHistoryRecord_test_4500e1e7_check" CHECK ("test" >= 0);
---
--- Alter field updatedBy on testitemhistoryrecord
---
-ALTER TABLE "TestItemHistoryRecord" ADD CONSTRAINT "TestItemHistoryRecord_updatedBy_aed0bd7a_check" CHECK ("updatedBy" >= 0);
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Alter field updatedBy on testitemhistoryrecord
---
---
--- Alter field test on testitemhistoryrecord
---
---
--- Alter field history_id on testitemhistoryrecord
---
-CREATE INDEX "TestItemHistoryRecord_history_id_3e2881da" ON "TestItemHistoryRecord" ("history_id");
---
--- Alter field createdBy on testitemhistoryrecord
---
---
--- Alter field updatedBy on testhistoryrecord
---
---
--- Alter field self on testhistoryrecord
---
---
--- Alter field history_id on testhistoryrecord
---
-CREATE INDEX "TestHistoryRecord_history_id_9e99b381" ON "TestHistoryRecord" ("history_id");
---
--- Alter field createdBy on testhistoryrecord
---
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20201110122058-0035_auto_20201110_0920.js b/apps/_demo/migrations/20201110122058-0035_auto_20201110_0920.js
deleted file mode 100644
index e3a5cbfa..00000000
--- a/apps/_demo/migrations/20201110122058-0035_auto_20201110_0920.js
+++ /dev/null
@@ -1,35 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0035_auto_20201110_0920:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjAtMTEtMTAgMDk6MjAKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKaW1wb3J0IGRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24KCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMzRfYXV0b18yMDIwMTEwOV8yMTI4JyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkFkZEZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd0ZXN0JywKICAgICAgICAgICAgbmFtZT0naXRlbScsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5Gb3JlaWduS2V5KGJsYW5rPVRydWUsIGRiX2NvbHVtbj0naXRlbScsIG51bGw9VHJ1ZSwgb25fZGVsZXRlPWRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24uRE9fTk9USElORywgcmVsYXRlZF9uYW1lPScrJywgdG89J19kamFuZ29fc2NoZW1hLnRlc3RpdGVtJyksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFkZEZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd0ZXN0aGlzdG9yeXJlY29yZCcsCiAgICAgICAgICAgIG5hbWU9J2l0ZW0nLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuVVVJREZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgIF0K
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Add field item to test
---
-ALTER TABLE "Test" ADD COLUMN "item" uuid NULL CONSTRAINT "Test_item_d2f14304_fk_TestItem_id" REFERENCES "TestItem"("id") DEFERRABLE INITIALLY DEFERRED; SET CONSTRAINTS "Test_item_d2f14304_fk_TestItem_id" IMMEDIATE;
---
--- Add field item to testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" ADD COLUMN "item" uuid NULL;
-CREATE INDEX "Test_item_d2f14304" ON "Test" ("item");
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Add field item to testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" DROP COLUMN "item" CASCADE;
---
--- Add field item to test
---
-ALTER TABLE "Test" DROP COLUMN "item" CASCADE;
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20201113124047-0036_auto_20201113_0941.js b/apps/_demo/migrations/20201113124047-0036_auto_20201113_0941.js
deleted file mode 100644
index 8f1dec53..00000000
--- a/apps/_demo/migrations/20201113124047-0036_auto_20201113_0941.js
+++ /dev/null
@@ -1,162 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0036_auto_20201113_0941:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjAtMTEtMTMgMDk6NDEKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zCgoKY2xhc3MgTWlncmF0aW9uKG1pZ3JhdGlvbnMuTWlncmF0aW9uKToKCiAgICBkZXBlbmRlbmNpZXMgPSBbCiAgICAgICAgKCdfZGphbmdvX3NjaGVtYScsICcwMDM1X2F1dG9fMjAyMDExMTBfMDkyMCcpLAogICAgXQoKICAgIG9wZXJhdGlvbnMgPSBbCiAgICAgICAgbWlncmF0aW9ucy5SZW5hbWVGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdCcsCiAgICAgICAgICAgIG9sZF9uYW1lPSdjcmVhdGVkQXRfdXRjJywKICAgICAgICAgICAgbmV3X25hbWU9J2NyZWF0ZWRBdCcsCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLlJlbmFtZUZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd0ZXN0JywKICAgICAgICAgICAgb2xkX25hbWU9J3VwZGF0ZWRBdF91dGMnLAogICAgICAgICAgICBuZXdfbmFtZT0ndXBkYXRlZEF0JywKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuUmVuYW1lRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3RoaXN0b3J5cmVjb3JkJywKICAgICAgICAgICAgb2xkX25hbWU9J2NyZWF0ZWRBdF91dGMnLAogICAgICAgICAgICBuZXdfbmFtZT0nY3JlYXRlZEF0JywKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuUmVuYW1lRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3RoaXN0b3J5cmVjb3JkJywKICAgICAgICAgICAgb2xkX25hbWU9J3VwZGF0ZWRBdF91dGMnLAogICAgICAgICAgICBuZXdfbmFtZT0ndXBkYXRlZEF0JywKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuUmVuYW1lRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3RpdGVtJywKICAgICAgICAgICAgb2xkX25hbWU9J2NyZWF0ZWRBdF91dGMnLAogICAgICAgICAgICBuZXdfbmFtZT0nY3JlYXRlZEF0JywKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuUmVuYW1lRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3RpdGVtJywKICAgICAgICAgICAgb2xkX25hbWU9J3VwZGF0ZWRBdF91dGMnLAogICAgICAgICAgICBuZXdfbmFtZT0ndXBkYXRlZEF0JywKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuUmVuYW1lRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3RpdGVtaGlzdG9yeXJlY29yZCcsCiAgICAgICAgICAgIG9sZF9uYW1lPSdjcmVhdGVkQXRfdXRjJywKICAgICAgICAgICAgbmV3X25hbWU9J2NyZWF0ZWRBdCcsCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLlJlbmFtZUZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd0ZXN0aXRlbWhpc3RvcnlyZWNvcmQnLAogICAgICAgICAgICBvbGRfbmFtZT0ndXBkYXRlZEF0X3V0YycsCiAgICAgICAgICAgIG5ld19uYW1lPSd1cGRhdGVkQXQnLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5SZW1vdmVGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdCcsCiAgICAgICAgICAgIG5hbWU9J2NyZWF0ZWRBdF9vZmZzZXQnLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5SZW1vdmVGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdCcsCiAgICAgICAgICAgIG5hbWU9J21ldGFTdHJpbmcnLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5SZW1vdmVGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdCcsCiAgICAgICAgICAgIG5hbWU9J3VwZGF0ZWRBdF9vZmZzZXQnLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5SZW1vdmVGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdGhpc3RvcnlyZWNvcmQnLAogICAgICAgICAgICBuYW1lPSdjcmVhdGVkQXRfb2Zmc2V0JywKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuUmVtb3ZlRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3RoaXN0b3J5cmVjb3JkJywKICAgICAgICAgICAgbmFtZT0nbWV0YVN0cmluZycsCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLlJlbW92ZUZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd0ZXN0aGlzdG9yeXJlY29yZCcsCiAgICAgICAgICAgIG5hbWU9J3VwZGF0ZWRBdF9vZmZzZXQnLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5SZW1vdmVGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdGl0ZW0nLAogICAgICAgICAgICBuYW1lPSdjcmVhdGVkQXRfb2Zmc2V0JywKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuUmVtb3ZlRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3RpdGVtJywKICAgICAgICAgICAgbmFtZT0ndXBkYXRlZEF0X29mZnNldCcsCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLlJlbW92ZUZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd0ZXN0aXRlbWhpc3RvcnlyZWNvcmQnLAogICAgICAgICAgICBuYW1lPSdjcmVhdGVkQXRfb2Zmc2V0JywKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuUmVtb3ZlRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3RpdGVtaGlzdG9yeXJlY29yZCcsCiAgICAgICAgICAgIG5hbWU9J3VwZGF0ZWRBdF9vZmZzZXQnLAogICAgICAgICksCiAgICBdCg==
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Rename field createdAt_utc on test to createdAt
---
-ALTER TABLE "Test" RENAME COLUMN "createdAt_utc" TO "createdAt";
---
--- Rename field updatedAt_utc on test to updatedAt
---
-ALTER TABLE "Test" RENAME COLUMN "updatedAt_utc" TO "updatedAt";
---
--- Rename field createdAt_utc on testhistoryrecord to createdAt
---
-ALTER TABLE "TestHistoryRecord" RENAME COLUMN "createdAt_utc" TO "createdAt";
---
--- Rename field updatedAt_utc on testhistoryrecord to updatedAt
---
-ALTER TABLE "TestHistoryRecord" RENAME COLUMN "updatedAt_utc" TO "updatedAt";
---
--- Rename field createdAt_utc on testitem to createdAt
---
-ALTER TABLE "TestItem" RENAME COLUMN "createdAt_utc" TO "createdAt";
---
--- Rename field updatedAt_utc on testitem to updatedAt
---
-ALTER TABLE "TestItem" RENAME COLUMN "updatedAt_utc" TO "updatedAt";
---
--- Rename field createdAt_utc on testitemhistoryrecord to createdAt
---
-ALTER TABLE "TestItemHistoryRecord" RENAME COLUMN "createdAt_utc" TO "createdAt";
---
--- Rename field updatedAt_utc on testitemhistoryrecord to updatedAt
---
-ALTER TABLE "TestItemHistoryRecord" RENAME COLUMN "updatedAt_utc" TO "updatedAt";
---
--- Remove field createdAt_offset from test
---
-ALTER TABLE "Test" DROP COLUMN "createdAt_offset" CASCADE;
---
--- Remove field metaString from test
---
-ALTER TABLE "Test" DROP COLUMN "metaString" CASCADE;
---
--- Remove field updatedAt_offset from test
---
-ALTER TABLE "Test" DROP COLUMN "updatedAt_offset" CASCADE;
---
--- Remove field createdAt_offset from testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" DROP COLUMN "createdAt_offset" CASCADE;
---
--- Remove field metaString from testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" DROP COLUMN "metaString" CASCADE;
---
--- Remove field updatedAt_offset from testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" DROP COLUMN "updatedAt_offset" CASCADE;
---
--- Remove field createdAt_offset from testitem
---
-ALTER TABLE "TestItem" DROP COLUMN "createdAt_offset" CASCADE;
---
--- Remove field updatedAt_offset from testitem
---
-ALTER TABLE "TestItem" DROP COLUMN "updatedAt_offset" CASCADE;
---
--- Remove field createdAt_offset from testitemhistoryrecord
---
-ALTER TABLE "TestItemHistoryRecord" DROP COLUMN "createdAt_offset" CASCADE;
---
--- Remove field updatedAt_offset from testitemhistoryrecord
---
-ALTER TABLE "TestItemHistoryRecord" DROP COLUMN "updatedAt_offset" CASCADE;
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Remove field updatedAt_offset from testitemhistoryrecord
---
-ALTER TABLE "TestItemHistoryRecord" ADD COLUMN "updatedAt_offset" text NULL;
---
--- Remove field createdAt_offset from testitemhistoryrecord
---
-ALTER TABLE "TestItemHistoryRecord" ADD COLUMN "createdAt_offset" text NULL;
---
--- Remove field updatedAt_offset from testitem
---
-ALTER TABLE "TestItem" ADD COLUMN "updatedAt_offset" text NULL;
---
--- Remove field createdAt_offset from testitem
---
-ALTER TABLE "TestItem" ADD COLUMN "createdAt_offset" text NULL;
---
--- Remove field updatedAt_offset from testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" ADD COLUMN "updatedAt_offset" text NULL;
---
--- Remove field metaString from testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" ADD COLUMN "metaString" jsonb NULL;
---
--- Remove field createdAt_offset from testhistoryrecord
---
-ALTER TABLE "TestHistoryRecord" ADD COLUMN "createdAt_offset" text NULL;
---
--- Remove field updatedAt_offset from test
---
-ALTER TABLE "Test" ADD COLUMN "updatedAt_offset" text NULL;
---
--- Remove field metaString from test
---
-ALTER TABLE "Test" ADD COLUMN "metaString" jsonb NULL;
---
--- Remove field createdAt_offset from test
---
-ALTER TABLE "Test" ADD COLUMN "createdAt_offset" text NULL;
---
--- Rename field updatedAt_utc on testitemhistoryrecord to updatedAt
---
-ALTER TABLE "TestItemHistoryRecord" RENAME COLUMN "updatedAt" TO "updatedAt_utc";
---
--- Rename field createdAt_utc on testitemhistoryrecord to createdAt
---
-ALTER TABLE "TestItemHistoryRecord" RENAME COLUMN "createdAt" TO "createdAt_utc";
---
--- Rename field updatedAt_utc on testitem to updatedAt
---
-ALTER TABLE "TestItem" RENAME COLUMN "updatedAt" TO "updatedAt_utc";
---
--- Rename field createdAt_utc on testitem to createdAt
---
-ALTER TABLE "TestItem" RENAME COLUMN "createdAt" TO "createdAt_utc";
---
--- Rename field updatedAt_utc on testhistoryrecord to updatedAt
---
-ALTER TABLE "TestHistoryRecord" RENAME COLUMN "updatedAt" TO "updatedAt_utc";
---
--- Rename field createdAt_utc on testhistoryrecord to createdAt
---
-ALTER TABLE "TestHistoryRecord" RENAME COLUMN "createdAt" TO "createdAt_utc";
---
--- Rename field updatedAt_utc on test to updatedAt
---
-ALTER TABLE "Test" RENAME COLUMN "updatedAt" TO "updatedAt_utc";
---
--- Rename field createdAt_utc on test to createdAt
---
-ALTER TABLE "Test" RENAME COLUMN "createdAt" TO "createdAt_utc";
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20201114151635-0037_testsoftdeletedobj_testsoftdeletedobjhistoryrecord.js b/apps/_demo/migrations/20201114151635-0037_testsoftdeletedobj_testsoftdeletedobjhistoryrecord.js
deleted file mode 100644
index 88601f38..00000000
--- a/apps/_demo/migrations/20201114151635-0037_testsoftdeletedobj_testsoftdeletedobjhistoryrecord.js
+++ /dev/null
@@ -1,38 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0037_testsoftdeletedobj_testsoftdeletedobjhistoryrecord:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjAtMTEtMTQgMTI6MTYKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKaW1wb3J0IGRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24KCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMzZfYXV0b18yMDIwMTExM18wOTQxJyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkNyZWF0ZU1vZGVsKAogICAgICAgICAgICBuYW1lPSd0ZXN0c29mdGRlbGV0ZWRvYmpoaXN0b3J5cmVjb3JkJywKICAgICAgICAgICAgZmllbGRzPVsKICAgICAgICAgICAgICAgICgnbWV0YScsIG1vZGVscy5KU09ORmllbGQoYmxhbms9VHJ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VkQnknLCBudWxsPVRydWUsIG9uX2RlbGV0ZT1kamFuZ28uZGIubW9kZWxzLmRlbGV0aW9uLkRPX05PVEhJTkcsIHJlbGF0ZWRfbmFtZT0nKycsIHRvPSdfZGphbmdvX3NjaGVtYS51c2VyJykpLAogICAgICAgICAgICBdLAogICAgICAgICAgICBvcHRpb25zPXsKICAgICAgICAgICAgICAgICdkYl90YWJsZSc6ICdUZXN0U29mdERlbGV0ZWRPYmonLAogICAgICAgICAgICB9LAogICAgICAgICksCiAgICBdCg==
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Create model testsoftdeletedobjhistoryrecord
---
-CREATE TABLE "TestSoftDeletedObjHistoryRecord" ("meta" jsonb NULL, "v" integer NULL, "createdAt" timestamp with time zone NULL, "updatedAt" timestamp with time zone NULL, "createdBy" integer NULL CHECK ("createdBy" >= 0), "updatedBy" integer NULL CHECK ("updatedBy" >= 0), "deletedAt" timestamp with time zone NULL, "id" uuid NOT NULL PRIMARY KEY, "history_date" timestamp with time zone NOT NULL, "history_action" varchar(50) NOT NULL, "history_id" integer NOT NULL CHECK ("history_id" >= 0));
---
--- Create model testsoftdeletedobj
---
-CREATE TABLE "TestSoftDeletedObj" ("id" serial NOT NULL PRIMARY KEY, "meta" jsonb NOT NULL, "v" integer NOT NULL, "createdAt" timestamp with time zone NULL, "updatedAt" timestamp with time zone NULL, "deletedAt" timestamp with time zone NULL, "createdBy" integer NULL, "updatedBy" integer NULL);
-ALTER TABLE "TestSoftDeletedObj" ADD CONSTRAINT "TestSoftDeletedObj_createdBy_51fda53c_fk_User_id" FOREIGN KEY ("createdBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "TestSoftDeletedObj" ADD CONSTRAINT "TestSoftDeletedObj_updatedBy_6a88de0e_fk_User_id" FOREIGN KEY ("updatedBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-CREATE INDEX "TestSoftDeletedObj_createdBy_51fda53c" ON "TestSoftDeletedObj" ("createdBy");
-CREATE INDEX "TestSoftDeletedObj_updatedBy_6a88de0e" ON "TestSoftDeletedObj" ("updatedBy");
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Create model testsoftdeletedobj
---
-DROP TABLE "TestSoftDeletedObj" CASCADE;
---
--- Create model testsoftdeletedobjhistoryrecord
---
-DROP TABLE "TestSoftDeletedObjHistoryRecord" CASCADE;
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20201114162752-0038_auto_20201114_1327.js b/apps/_demo/migrations/20201114162752-0038_auto_20201114_1327.js
deleted file mode 100644
index 90357148..00000000
--- a/apps/_demo/migrations/20201114162752-0038_auto_20201114_1327.js
+++ /dev/null
@@ -1,26 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0038_auto_20201114_1327:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjAtMTEtMTQgMTM6MjcKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMzdfdGVzdHNvZnRkZWxldGVkb2JqX3Rlc3Rzb2Z0ZGVsZXRlZG9iamhpc3RvcnlyZWNvcmQnKSwKICAgIF0KCiAgICBvcGVyYXRpb25zID0gWwogICAgICAgIG1pZ3JhdGlvbnMuQWx0ZXJGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdHNvZnRkZWxldGVkb2JqJywKICAgICAgICAgICAgbmFtZT0nbWV0YScsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5KU09ORmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgXQo=
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Alter field meta on testsoftdeletedobj
---
-ALTER TABLE "TestSoftDeletedObj" ALTER COLUMN "meta" DROP NOT NULL;
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Alter field meta on testsoftdeletedobj
---
-ALTER TABLE "TestSoftDeletedObj" ALTER COLUMN "meta" SET NOT NULL;
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20201114170851-0039_auto_20201114_1408.js b/apps/_demo/migrations/20201114170851-0039_auto_20201114_1408.js
deleted file mode 100644
index 359409ff..00000000
--- a/apps/_demo/migrations/20201114170851-0039_auto_20201114_1408.js
+++ /dev/null
@@ -1,25 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0039_auto_20201114_1408:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjAtMTEtMTQgMTQ6MDgKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMzhfYXV0b18yMDIwMTExNF8xMzI3JyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3Rzb2Z0ZGVsZXRlZG9iaicsCiAgICAgICAgICAgIG5hbWU9J2RlbGV0ZWRBdCcsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5EYXRlVGltZUZpZWxkKGJsYW5rPVRydWUsIGRiX2luZGV4PVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgIF0K
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Alter field deletedAt on testsoftdeletedobj
---
-CREATE INDEX "TestSoftDeletedObj_deletedAt_c5f1b37f" ON "TestSoftDeletedObj" ("deletedAt");
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Alter field deletedAt on testsoftdeletedobj
---
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20201114181941-0040_auto_20201114_1519.js b/apps/_demo/migrations/20201114181941-0040_auto_20201114_1519.js
deleted file mode 100644
index de4d6247..00000000
--- a/apps/_demo/migrations/20201114181941-0040_auto_20201114_1519.js
+++ /dev/null
@@ -1,39 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0040_auto_20201114_1519:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjAtMTEtMTQgMTU6MTkKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMzlfYXV0b18yMDIwMTExNF8xNDA4JyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3RoaXN0b3J5cmVjb3JkJywKICAgICAgICAgICAgbmFtZT0naGlzdG9yeV9pZCcsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5Qb3NpdGl2ZUludGVnZXJGaWVsZChkYl9pbmRleD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWx0ZXJGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdGl0ZW1oaXN0b3J5cmVjb3JkJywKICAgICAgICAgICAgbmFtZT0naGlzdG9yeV9pZCcsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5VVUlERmllbGQoZGJfaW5kZXg9VHJ1ZSksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3Rzb2Z0ZGVsZXRlZG9iamhpc3RvcnlyZWNvcmQnLAogICAgICAgICAgICBuYW1lPSdoaXN0b3J5X2lkJywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLlBvc2l0aXZlSW50ZWdlckZpZWxkKGRiX2luZGV4PVRydWUpLAogICAgICAgICksCiAgICBdCg==
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Alter field history_id on testhistoryrecord
---
-CREATE INDEX "TestHistoryRecord_history_id_9e99b381" ON "TestHistoryRecord" ("history_id");
---
--- Alter field history_id on testitemhistoryrecord
---
-CREATE INDEX "TestItemHistoryRecord_history_id_3e2881da" ON "TestItemHistoryRecord" ("history_id");
---
--- Alter field history_id on testsoftdeletedobjhistoryrecord
---
-CREATE INDEX "TestSoftDeletedObjHistoryRecord_history_id_07d9171f" ON "TestSoftDeletedObjHistoryRecord" ("history_id");
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Alter field history_id on testsoftdeletedobjhistoryrecord
---
---
--- Alter field history_id on testitemhistoryrecord
---
---
--- Alter field history_id on testhistoryrecord
---
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20201114191744-0041_auto_20201114_1617.js b/apps/_demo/migrations/20201114191744-0041_auto_20201114_1617.js
deleted file mode 100644
index 0a6cc9c4..00000000
--- a/apps/_demo/migrations/20201114191744-0041_auto_20201114_1617.js
+++ /dev/null
@@ -1,34 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0041_auto_20201114_1617:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjAtMTEtMTQgMTY6MTcKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwNDBfYXV0b18yMDIwMTExNF8xNTE5JyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkFkZEZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd0ZXN0c29mdGRlbGV0ZWRvYmonLAogICAgICAgICAgICBuYW1lPSduZXdJZCcsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5Qb3NpdGl2ZUludGVnZXJGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BZGRGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdHNvZnRkZWxldGVkb2JqaGlzdG9yeXJlY29yZCcsCiAgICAgICAgICAgIG5hbWU9J25ld0lkJywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLkpTT05GaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpLAogICAgICAgICksCiAgICBdCg==
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Add field newId to testsoftdeletedobj
---
-ALTER TABLE "TestSoftDeletedObj" ADD COLUMN "newId" integer NULL CHECK ("newId" >= 0);
---
--- Add field newId to testsoftdeletedobjhistoryrecord
---
-ALTER TABLE "TestSoftDeletedObjHistoryRecord" ADD COLUMN "newId" jsonb NULL;
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Add field newId to testsoftdeletedobjhistoryrecord
---
-ALTER TABLE "TestSoftDeletedObjHistoryRecord" DROP COLUMN "newId" CASCADE;
---
--- Add field newId to testsoftdeletedobj
---
-ALTER TABLE "TestSoftDeletedObj" DROP COLUMN "newId" CASCADE;
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20201124164415-0042_testautoincrementnumber.js b/apps/_demo/migrations/20201124164415-0042_testautoincrementnumber.js
deleted file mode 100644
index 46254f17..00000000
--- a/apps/_demo/migrations/20201124164415-0042_testautoincrementnumber.js
+++ /dev/null
@@ -1,26 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0042_testautoincrementnumber:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjAtMTEtMjQgMTM6NDQKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwNDFfYXV0b18yMDIwMTExNF8xNjE3JyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkNyZWF0ZU1vZGVsKAogICAgICAgICAgICBuYW1lPSd0ZXN0YXV0b2luY3JlbWVudG51bWJlcicsCiAgICAgICAgICAgIGZpZWxkcz1bCiAgICAgICAgICAgICAgICAoJ2lkJywgbW9kZWxzLkF1dG9GaWVsZChwcmltYXJ5X2tleT1UcnVlLCBzZXJpYWxpemU9RmFsc2UpKSwKICAgICAgICAgICAgICAgICgnbnVtYmVyJywgbW9kZWxzLkludGVnZXJGaWVsZChibGFuaz1UcnVlLCB1bmlxdWU9VHJ1ZSkpLAogICAgICAgICAgICBdLAogICAgICAgICAgICBvcHRpb25zPXsKICAgICAgICAgICAgICAgICdkYl90YWJsZSc6ICdUZXN0QXV0b0luY3JlbWVudE51bWJlcicsCiAgICAgICAgICAgIH0sCiAgICAgICAgKSwKICAgIF0K
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Create model testautoincrementnumber
---
-CREATE TABLE "TestAutoIncrementNumber" ("id" serial NOT NULL PRIMARY KEY, "number" integer NOT NULL UNIQUE);
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Create model testautoincrementnumber
---
-DROP TABLE "TestAutoIncrementNumber" CASCADE;
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20210204005245-0043_auto_20210203_2152.js b/apps/_demo/migrations/20210204005245-0043_auto_20210203_2152.js
deleted file mode 100644
index 9171bbfd..00000000
--- a/apps/_demo/migrations/20210204005245-0043_auto_20210203_2152.js
+++ /dev/null
@@ -1,188 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0043_auto_20210203_2152:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjEtMDItMDMgMjE6NTIKCmltcG9ydCBkamFuZ28uY29udHJpYi5wb3N0Z3Jlcy5maWVsZHMuanNvbmIKZnJvbSBkamFuZ28uZGIgaW1wb3J0IG1pZ3JhdGlvbnMsIG1vZGVscwoKCmNsYXNzIE1pZ3JhdGlvbihtaWdyYXRpb25zLk1pZ3JhdGlvbik6CgogICAgZGVwZW5kZW5jaWVzID0gWwogICAgICAgICgnX2RqYW5nb19zY2hlbWEnLCAnMDA0Ml90ZXN0YXV0b2luY3JlbWVudG51bWJlcicpLAogICAgXQoKICAgIG9wZXJhdGlvbnMgPSBbCiAgICAgICAgbWlncmF0aW9ucy5SZW1vdmVGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndXNlcicsCiAgICAgICAgICAgIG5hbWU9J3JhdGluZycsCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLlJlbW92ZUZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd1c2VyJywKICAgICAgICAgICAgbmFtZT0nc2V0dGluZ3MnLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BbHRlckZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSdvcmdhbml6YXRpb24nLAogICAgICAgICAgICBuYW1lPSdhdmF0YXInLAogICAgICAgICAgICBmaWVsZD1kamFuZ28uY29udHJpYi5wb3N0Z3Jlcy5maWVsZHMuanNvbmIuSlNPTkZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3QnLAogICAgICAgICAgICBuYW1lPSdjcmVhdGVkQXQnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuRGF0ZVRpbWVGaWVsZChibGFuaz1UcnVlLCBkYl9pbmRleD1UcnVlLCBudWxsPVRydWUpLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BbHRlckZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd0ZXN0JywKICAgICAgICAgICAgbmFtZT0nZmlsZScsCiAgICAgICAgICAgIGZpZWxkPWRqYW5nby5jb250cmliLnBvc3RncmVzLmZpZWxkcy5qc29uYi5KU09ORmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWx0ZXJGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdCcsCiAgICAgICAgICAgIG5hbWU9J21ldGEnLAogICAgICAgICAgICBmaWVsZD1kamFuZ28uY29udHJpYi5wb3N0Z3Jlcy5maWVsZHMuanNvbmIuSlNPTkZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3QnLAogICAgICAgICAgICBuYW1lPSdzZXR0aW5ncycsCiAgICAgICAgICAgIGZpZWxkPWRqYW5nby5jb250cmliLnBvc3RncmVzLmZpZWxkcy5qc29uYi5KU09ORmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWx0ZXJGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdCcsCiAgICAgICAgICAgIG5hbWU9J3VwZGF0ZWRBdCcsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5EYXRlVGltZUZpZWxkKGJsYW5rPVRydWUsIGRiX2luZGV4PVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3QnLAogICAgICAgICAgICBuYW1lPSd2ZW51ZScsCiAgICAgICAgICAgIGZpZWxkPWRqYW5nby5jb250cmliLnBvc3RncmVzLmZpZWxkcy5qc29uYi5KU09ORmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWx0ZXJGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdGhpc3RvcnlyZWNvcmQnLAogICAgICAgICAgICBuYW1lPSdmaWxlJywKICAgICAgICAgICAgZmllbGQ9ZGphbmdvLmNvbnRyaWIucG9zdGdyZXMuZmllbGRzLmpzb25iLkpTT05GaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BbHRlckZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd0ZXN0aGlzdG9yeXJlY29yZCcsCiAgICAgICAgICAgIG5hbWU9J21ldGEnLAogICAgICAgICAgICBmaWVsZD1kamFuZ28uY29udHJpYi5wb3N0Z3Jlcy5maWVsZHMuanNvbmIuSlNPTkZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3RoaXN0b3J5cmVjb3JkJywKICAgICAgICAgICAgbmFtZT0nc2V0dGluZ3MnLAogICAgICAgICAgICBmaWVsZD1kamFuZ28uY29udHJpYi5wb3N0Z3Jlcy5maWVsZHMuanNvbmIuSlNPTkZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3RoaXN0b3J5cmVjb3JkJywKICAgICAgICAgICAgbmFtZT0ndmVudWUnLAogICAgICAgICAgICBmaWVsZD1kamFuZ28uY29udHJpYi5wb3N0Z3Jlcy5maWVsZHMuanNvbmIuSlNPTkZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3RoaXN0b3J5cmVjb3JkJywKICAgICAgICAgICAgbmFtZT0ndmlyMScsCiAgICAgICAgICAgIGZpZWxkPWRqYW5nby5jb250cmliLnBvc3RncmVzLmZpZWxkcy5qc29uYi5KU09ORmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWx0ZXJGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdGl0ZW0nLAogICAgICAgICAgICBuYW1lPSdjcmVhdGVkQXQnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuRGF0ZVRpbWVGaWVsZChibGFuaz1UcnVlLCBkYl9pbmRleD1UcnVlLCBudWxsPVRydWUpLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BbHRlckZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd0ZXN0aXRlbScsCiAgICAgICAgICAgIG5hbWU9J21ldGEnLAogICAgICAgICAgICBmaWVsZD1kamFuZ28uY29udHJpYi5wb3N0Z3Jlcy5maWVsZHMuanNvbmIuSlNPTkZpZWxkKCksCiAg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ICAgIG5hbWU9J21ldGEnLAogICAgICAgICAgICBmaWVsZD1kamFuZ28uY29udHJpYi5wb3N0Z3Jlcy5maWVsZHMuanNvbmIuSlNPTkZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkRlbGV0ZU1vZGVsKAogICAgICAgICAgICBuYW1lPSd0b2RvJywKICAgICAgICApLAogICAgXQo=
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Remove field rating from user
---
-ALTER TABLE "User" DROP COLUMN "rating" CASCADE;
---
--- Remove field settings from user
---
-ALTER TABLE "User" DROP COLUMN "settings" CASCADE;
---
--- Alter field avatar on organization
---
---
--- Alter field createdAt on test
---
-CREATE INDEX "Test_createdAt_febd0326" ON "Test" ("createdAt");
---
--- Alter field file on test
---
---
--- Alter field meta on test
---
---
--- Alter field settings on test
---
---
--- Alter field updatedAt on test
---
-CREATE INDEX "Test_updatedAt_1072d8fc" ON "Test" ("updatedAt");
---
--- Alter field venue on test
---
---
--- Alter field file on testhistoryrecord
---
---
--- Alter field meta on testhistoryrecord
---
---
--- Alter field settings on testhistoryrecord
---
---
--- Alter field venue on testhistoryrecord
---
---
--- Alter field vir1 on testhistoryrecord
---
---
--- Alter field createdAt on testitem
---
-CREATE INDEX "TestItem_createdAt_8999fc86" ON "TestItem" ("createdAt");
---
--- Alter field meta on testitem
---
---
--- Alter field updatedAt on testitem
---
-CREATE INDEX "TestItem_updatedAt_f028fe01" ON "TestItem" ("updatedAt");
---
--- Alter field meta on testitemhistoryrecord
---
---
--- Alter field createdAt on testsoftdeletedobj
---
-CREATE INDEX "TestSoftDeletedObj_createdAt_2cbf10d1" ON "TestSoftDeletedObj" ("createdAt");
---
--- Alter field meta on testsoftdeletedobj
---
---
--- Alter field updatedAt on testsoftdeletedobj
---
-CREATE INDEX "TestSoftDeletedObj_updatedAt_ce501eb9" ON "TestSoftDeletedObj" ("updatedAt");
---
--- Alter field meta on testsoftdeletedobjhistoryrecord
---
---
--- Alter field newId on testsoftdeletedobjhistoryrecord
---
---
--- Alter field avatar on user
---
---
--- Alter field meta on user
---
---
--- Delete model todo
---
-DROP TABLE "Todo" CASCADE;
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Delete model todo
---
-CREATE TABLE "Todo" ("id" serial NOT NULL PRIMARY KEY, "description" text NOT NULL, "isComplete" boolean NOT NULL, "deadline" date NOT NULL, "stars" integer NULL, "assignee" integer NULL);
---
--- Alter field meta on user
---
---
--- Alter field avatar on user
---
---
--- Alter field newId on testsoftdeletedobjhistoryrecord
---
---
--- Alter field meta on testsoftdeletedobjhistoryrecord
---
---
--- Alter field updatedAt on testsoftdeletedobj
---
---
--- Alter field meta on testsoftdeletedobj
---
---
--- Alter field createdAt on testsoftdeletedobj
---
---
--- Alter field meta on testitemhistoryrecord
---
---
--- Alter field updatedAt on testitem
---
---
--- Alter field meta on testitem
---
---
--- Alter field createdAt on testitem
---
---
--- Alter field vir1 on testhistoryrecord
---
---
--- Alter field venue on testhistoryrecord
---
---
--- Alter field settings on testhistoryrecord
---
---
--- Alter field meta on testhistoryrecord
---
---
--- Alter field file on testhistoryrecord
---
---
--- Alter field venue on test
---
---
--- Alter field updatedAt on test
---
---
--- Alter field settings on test
---
---
--- Alter field meta on test
---
---
--- Alter field file on test
---
---
--- Alter field createdAt on test
---
---
--- Alter field avatar on organization
---
---
--- Remove field settings from user
---
-ALTER TABLE "User" ADD COLUMN "settings" jsonb NULL;
---
--- Remove field rating from user
---
-ALTER TABLE "User" ADD COLUMN "rating" integer NULL;
-ALTER TABLE "Todo" ADD CONSTRAINT "Todo_assignee_c94c59ce_fk_User_id" FOREIGN KEY ("assignee") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-CREATE INDEX "Todo_assignee_c94c59ce" ON "Todo" ("assignee");
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/migrations/20210204103435-0044_auto_20210204_0734.js b/apps/_demo/migrations/20210204103435-0044_auto_20210204_0734.js
deleted file mode 100644
index 67d8a88f..00000000
--- a/apps/_demo/migrations/20210204103435-0044_auto_20210204_0734.js
+++ /dev/null
@@ -1,34 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0044_auto_20210204_0734:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjEtMDItMDQgMDc6MzQKCmltcG9ydCBkamFuZ28uY29udHJpYi5wb3N0Z3Jlcy5maWVsZHMuanNvbmIKZnJvbSBkamFuZ28uZGIgaW1wb3J0IG1pZ3JhdGlvbnMsIG1vZGVscwoKCmNsYXNzIE1pZ3JhdGlvbihtaWdyYXRpb25zLk1pZ3JhdGlvbik6CgogICAgZGVwZW5kZW5jaWVzID0gWwogICAgICAgICgnX2RqYW5nb19zY2hlbWEnLCAnMDA0M19hdXRvXzIwMjEwMjAzXzIxNTInKSwKICAgIF0KCiAgICBvcGVyYXRpb25zID0gWwogICAgICAgIG1pZ3JhdGlvbnMuQWRkRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3VzZXInLAogICAgICAgICAgICBuYW1lPSdyYXRpbmcnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuSW50ZWdlckZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFkZEZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd1c2VyJywKICAgICAgICAgICAgbmFtZT0nc2V0dGluZ3MnLAogICAgICAgICAgICBmaWVsZD1kamFuZ28uY29udHJpYi5wb3N0Z3Jlcy5maWVsZHMuanNvbmIuSlNPTkZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgIF0K
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Add field rating to user
---
-ALTER TABLE "User" ADD COLUMN "rating" integer NULL;
---
--- Add field settings to user
---
-ALTER TABLE "User" ADD COLUMN "settings" jsonb NULL;
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Add field settings to user
---
-ALTER TABLE "User" DROP COLUMN "settings" CASCADE;
---
--- Add field rating to user
---
-ALTER TABLE "User" DROP COLUMN "rating" CASCADE;
-COMMIT;
-
- `)
-}
diff --git a/apps/_demo/next.config.js b/apps/_demo/next.config.js
deleted file mode 100644
index 6f8700aa..00000000
--- a/apps/_demo/next.config.js
+++ /dev/null
@@ -1,23 +0,0 @@
-const conf = require('@core/config')
-const withLess = require('@zeit/next-less')
-const withCSS = require('@zeit/next-css')
-// Tell webpack to compile the "@core/next" package, necessary
-// https://www.npmjs.com/package/next-transpile-modules
-// NOTE: FormTable require rc-table module
-const withTM = require('next-transpile-modules')(['@core/next', '@app/ex02front', 'rc-table'])
-
-const serverUrl = process.env.SERVER_URL || 'http://localhost:3000'
-const apolloGraphQLUrl = `${serverUrl}/admin/api`
-const firebaseConfig = conf['FIREBASE_CONFIG'] && JSON.parse(conf['FIREBASE_CONFIG'])
-
-module.exports = withTM(withLess(withCSS({
- publicRuntimeConfig: {
- // Will be available on both server and client
- serverUrl,
- apolloGraphQLUrl,
- firebaseConfig,
- },
- lessLoaderOptions: {
- javascriptEnabled: true,
- },
-})))
diff --git a/apps/_demo/package.json b/apps/_demo/package.json
deleted file mode 100644
index 48aaa7bf..00000000
--- a/apps/_demo/package.json
+++ /dev/null
@@ -1,69 +0,0 @@
-{
- "name": "@app/demo",
- "version": "1.0.0",
- "private": true,
- "scripts": {
- "test": "jest",
- "dev": "keystone dev",
- "debug": "node inspect node_modules/.bin/keystone dev",
- "build": "keystone build",
- "start": "keystone start",
- "makemigrations": "./../../bin/kmigrator.py makemigrations",
- "migrate": "./../../bin/kmigrator.py migrate"
- },
- "dependencies": {
- "@emotion/core": "^10.1.1",
- "@emotion/styled": "^10.0.27",
- "@keystonejs/adapter-knex": "^12.0.2",
- "@keystonejs/adapter-mongoose": "^10.0.1",
- "@keystonejs/adapter-prisma": "^1.1.2",
- "@keystonejs/app-admin-ui": "^7.3.9",
- "@keystonejs/app-graphql": "^6.1.0",
- "@keystonejs/app-next": "^5.2.1",
- "@keystonejs/app-static": "^5.1.2",
- "@keystonejs/auth-password": "^5.1.17",
- "@keystonejs/fields-wysiwyg-tinymce": "^5.3.13",
- "@keystonejs/file-adapters": "^7.0.3",
- "@keystonejs/keystone": "^17.1.1",
- "@keystonejs/server-side-graphql-client": "^1.1.2",
- "@keystonejs/utils": "^6.0.1",
- "@keystonejs/fields-color": "^1.0.7",
- "@keystonejs/fields-content": "^9.0.2",
- "@keystonejs/fields-location-google": "^3.0.2",
- "@keystonejs/list-plugins": "^7.1.4",
- "@testing-library/jest-dom": "^5.11.4",
- "@testing-library/react": "^10.4.9",
- "@welldone-software/why-did-you-render": "^5.0.0-alpha.1",
- "@zeit/next-css": "^1.0.1",
- "@zeit/next-less": "^1.0.1",
- "antd": "^4.8.2",
- "babel-jest": "^26.6.3",
- "classnames": "2.2.6",
- "date-fns": "^2.15.0",
- "emotion": "^10.0.27",
- "emotion-server": "^10.0.27",
- "express": "^4.17.1",
- "facepaint": "^1.2.1",
- "firebase": "^7.19.0",
- "get-contrast": "^2.0.0",
- "immer": "^8.0.1",
- "jest": "^26.6.3",
- "less": "^3.12.2",
- "lodash": "^4.17.20",
- "next": "^9.5.2",
- "next-transpile-modules": "^4.1.0",
- "numeral": "2.0.6",
- "qs": "^6.9.4",
- "rc-queue-anim": "^1.8.5",
- "react": "^16.13.1",
- "react-dom": "^16.13.1",
- "react-fittext": "^1.0.0",
- "react-markdown": "^4.3.1",
- "react-responsive": "^8.1.0",
- "react-test-renderer": "^16.13.1",
- "use-immer": "^0.4.1",
- "uuid": "^8.3.0",
- "validator": "^13.1.1"
- },
- "repository": "https://github.com/pahaz/hackathon-boilerplate-starter-kit/tree/master/apps/_demo"
-}
diff --git a/apps/_demo/pages/_app.jsx b/apps/_demo/pages/_app.jsx
deleted file mode 100644
index aa64cd9f..00000000
--- a/apps/_demo/pages/_app.jsx
+++ /dev/null
@@ -1,83 +0,0 @@
-import React from 'react'
-import Head from 'next/head'
-import { CacheProvider } from '@emotion/core'
-import { cache } from 'emotion'
-import { DashboardOutlined, UserOutlined } from '@ant-design/icons'
-import whyDidYouRender from '@welldone-software/why-did-you-render'
-
-import { withApollo } from '@core/next/apollo'
-import { withAuth } from '@core/next/auth'
-import { withIntl } from '@core/next/intl'
-import { useOrganization, withOrganization } from '@core/next/organization'
-
-import GlobalStyle from '@app/ex02front/containers/GlobalStyle'
-import GoogleAnalytics from '@app/ex02front/containers/GoogleAnalytics'
-import BaseLayout from '@app/ex02front/containers/BaseLayout'
-import GlobalErrorBoundary from '@app/ex02front/containers/GlobalErrorBoundery'
-
-if (typeof window !== 'undefined' && process.env.NODE_ENV === 'development') {
- whyDidYouRender(React, {
- logOnDifferentValues: true,
- })
-}
-
-function menuDataRender () {
- const org = useOrganization()
- if (org && org.link && org.link.role === 'owner') {
- return [
- {
- path: '/',
- icon: ,
- locale: 'menu.Home',
- },
- {
- path: '/users',
- icon: ,
- locale: 'menu.Users',
- },
- ]
- } else {
- return [
- {
- path: '/',
- icon: ,
- locale: 'menu.Home',
- },
- ]
- }
-}
-
-const MyApp = ({ Component, pageProps }) => {
- const LayoutComponent = Component.container || BaseLayout
- return (
-
-
-
-
-
-
-
-
-
-
-
-
-
- )
-}
-
-async function messagesImporter (locale) {
- const base = await import(`../../_ex02front/lang/${locale}`)
- const override = await import(`../lang/${locale}`)
- return { ...base.default, ...override.default }
-}
-
-export default (
- withApollo({ ssr: true })(
- withIntl({ ssr: true, messagesImporter })(
- withAuth({ ssr: true })(
- withOrganization({ ssr: true })(
- MyApp)))))
diff --git a/apps/_demo/pages/_document.js b/apps/_demo/pages/_document.js
deleted file mode 100644
index feefc6e8..00000000
--- a/apps/_demo/pages/_document.js
+++ /dev/null
@@ -1,27 +0,0 @@
-import Document, { Html, Head, Main, NextScript } from 'next/document'
-import { extractCritical } from 'emotion-server'
-
-export default class MyDocument extends Document {
- static getInitialProps ({ renderPage }) {
- const page = renderPage()
- const styles = extractCritical(page.html)
- return { ...page, ...styles }
- }
-
- render () {
- const innerHtml = { __html: this.props.css }
- return (
-
-
-
-
-
-
-
- )
- }
-}
diff --git a/apps/_demo/pages/auth/register.jsx b/apps/_demo/pages/auth/register.jsx
deleted file mode 100644
index f47c4a50..00000000
--- a/apps/_demo/pages/auth/register.jsx
+++ /dev/null
@@ -1,301 +0,0 @@
-/** @jsx jsx */
-import { css, jsx } from '@emotion/core'
-import { Button, Form, Input, Typography } from 'antd'
-import { createContext, useContext, useEffect, useRef, useState } from 'react'
-import Head from 'next/head'
-import Router from 'next/router'
-import gql from 'graphql-tag'
-
-import { useIntl } from '@core/next/intl'
-
-import { TopMenuOnlyLayout } from '@app/ex02front/containers/BaseLayout'
-import { RegisterForm } from '@app/ex02front/pages/auth/register'
-
-import firebase, { isFirebaseConfigValid } from '../../utils/firebase.front.utils'
-import { useMutation } from '@core/next/apollo'
-
-const REGISTER_NEW_USER_MUTATION = gql`
- mutation registerNewUser($data: RegisterNewUserInput!) {
- user: registerNewUser(data: $data) {
- id
- name
- isAdmin
- }
- }
-`
-
-const AuthContext = createContext({})
-
-function AuthState ({ children, initialUser }) {
- const [user, setUser] = useState(initialUser || null)
-
- useEffect(() => {
- return firebase.auth().onAuthStateChanged(async function (user) {
- console.log('onAuthStateChanged', user)
- if (user) {
- const token = await user.getIdToken(true)
- console.log('auth:', token)
- user.token = token
- }
-
- setUser(user)
- })
- }, [])
-
- async function sendCode (phoneNumber, recaptchaVerifier) {
- const phoneProvider = new firebase.auth.PhoneAuthProvider()
- const verificationId = await phoneProvider.verifyPhoneNumber(
- phoneNumber,
- // @ts-ignore
- recaptchaVerifier,
- )
- return verificationId
- }
-
- async function verifyCode (verificationId, verificationCode) {
- const credential = firebase.auth.PhoneAuthProvider.credential(
- verificationId,
- verificationCode,
- )
- await firebase
- .auth()
- .signInWithCredential(credential)
- // const user = await firebase
- // .auth()
- // .currentUser
- // // await setCurrentUser(JSON.parse(JSON.stringify(user)))
- // // const u = await getCurrentUser()
- // setUser(user)
- return true
- }
-
- async function signout () {
- return await firebase.auth().signOut()
- // setUser(null)
- // await setCurrentUser(null)
- }
-
- return (
-
- {children}
-
- )
-}
-
-function PhoneAuthForm ({ onPhoneAuthenticated }) {
- // TODO(pahaz): how-to change phone!? If you want to register new user?!?!
- const { user, sendCode, verifyCode } = useContext(AuthContext)
- const recaptchaVerifier = useRef(null)
- const verificationCodeTextInput = useRef(null)
- const [captcha, setCaptcha] = useState('')
- const [verificationId, setVerificationId] = useState('')
- const [verifyError, setVerifyError] = useState('')
- const [verifyInProgress, setVerifyInProgress] = useState(false)
- const [verificationCode, setVerificationCode] = useState('')
- const [confirmError, setConfirmError] = useState('')
- const [confirmInProgress, setConfirmInProgress] = useState(false)
- const [form] = Form.useForm()
-
- const intl = useIntl()
- const SignInMsg = intl.formatMessage({ id: 'SignIn' })
- const ClientSideErrorMsg = intl.formatMessage({ id: 'ClientSideError' })
- const EnterPhoneNumberMsg = intl.formatMessage({ id: 'EnterPhoneNumber' })
- const FieldIsRequiredMsg = intl.formatMessage({ id: 'FieldIsRequired' })
- const SendVerificationCodeMsg = intl.formatMessage({ id: 'SendVerificationCode' })
- const ResendVerificationCodeMsg = intl.formatMessage({ id: 'ResendVerificationCode' })
- const EnterVerificationCodeMsg = intl.formatMessage({ id: 'EnterVerificationCode' })
- const ConfirmVerificationCodeMsg = intl.formatMessage({ id: 'ConfirmVerificationCode' })
- const VerificationCodeHasBeenSentToYourPhoneMsg = intl.formatMessage({ id: 'VerificationCodeHasBeenSentToYourPhone' })
- const PhoneMsg = intl.formatMessage({ id: 'Phone' })
- const ExamplePhoneMsg = intl.formatMessage({ id: 'example.Phone' })
-
- useEffect(() => {
- const recapcha = new firebase.auth.RecaptchaVerifier('recaptcha-container', {
- 'size': 'invisible',
- 'callback': function (response) {
- // reCAPTCHA solved, allow signInWithPhoneNumber.
- // ...
- setCaptcha(response)
- },
- 'expired-callback': function () {
- // Response expired. Ask user to solve reCAPTCHA again.
- // ...
- setCaptcha('')
- },
- })
- recaptchaVerifier.current = recapcha
- if (typeof window !== 'undefined') window.recaptchaVerifier = recapcha
- return () => {
- recapcha.clear()
- }
- }, [])
-
- async function handleSendCode () {
- const { phone } = await form.validateFields(['phone'])
- try {
- setVerifyError('')
- setVerifyInProgress(true)
- setVerificationId('')
- const verificationId = await sendCode(phone, recaptchaVerifier.current)
- setVerifyInProgress(false)
- setVerificationId(verificationId)
- verificationCodeTextInput.current?.focus()
- } catch (err) {
- setVerifyError(String(err))
- setVerifyInProgress(false)
- }
- }
-
- async function handleVerifyCode () {
- const { code } = await form.validateFields(['code'])
- try {
- setConfirmError('')
- setConfirmInProgress(true)
- await verifyCode(verificationId, code)
- setConfirmInProgress(false)
- setVerificationId('')
- setVerificationCode('')
- verificationCodeTextInput.current?.clear()
- // Alert.alert('Phone authentication successful!')
- } catch (err) {
- setConfirmError(String(err))
- setConfirmInProgress(false)
- }
- }
-
- if (!isFirebaseConfigValid) {
- return {ClientSideErrorMsg}
- }
-
- if (user) {
- return onPhoneAuthenticated({ user })
- }
-
- return <>
-
-
-
-
-
- {(verificationId) ?
-
-
-
- :
- null
- }
-
-
- {(verificationId) ?
- <>
-
-
- >
- :
- <>
-
-
- >
- }
-
-
- >
-}
-
-function RegisterByPhoneForm () {
- const [register] = useMutation(REGISTER_NEW_USER_MUTATION)
-
- const intl = useIntl()
- const FieldIsRequiredMsg = intl.formatMessage({ id: 'FieldIsRequired' })
- const PhoneIsAlreadyRegisteredMsg = intl.formatMessage({ id: 'pages.auth.PhoneIsAlreadyRegistered' })
- const PhoneMsg = intl.formatMessage({ id: 'Phone' })
- const ExtraErrorToFormFieldMsgMapping = {
- '[unique:importId:multipleFound]': {
- name: '_phone',
- errors: [PhoneIsAlreadyRegisteredMsg],
- },
- '[unique:phone:multipleFound]': {
- name: '_phone',
- errors: [PhoneIsAlreadyRegisteredMsg],
- },
- }
-
- return
{
- return
-
- {PhoneMsg}{' '}
-
- }
- rules={[{ required: true, message: FieldIsRequiredMsg }]}
- key={user.phoneNumber}
- initialValue={user.phoneNumber}
- >
-
-
-
-
-
-
- }}/>
-}
-
-const RegisterPage = () => {
- const intl = useIntl()
- const RegistrationTitleMsg = intl.formatMessage({ id: 'pages.auth.RegistrationTitle' })
- return (<>
-
- {RegistrationTitleMsg}
-
- {RegistrationTitleMsg}
-
-
-
- >)
-}
-
-RegisterPage.container = TopMenuOnlyLayout
-export default RegisterPage
-export {
- AuthState,
- PhoneAuthForm,
-}
diff --git a/apps/_demo/pages/auth/signin.jsx b/apps/_demo/pages/auth/signin.jsx
deleted file mode 100644
index 8e83b248..00000000
--- a/apps/_demo/pages/auth/signin.jsx
+++ /dev/null
@@ -1,158 +0,0 @@
-/** @jsx jsx */
-import { css, jsx } from '@emotion/core'
-import { Button, Form, Input, Typography } from 'antd'
-import { useState } from 'react'
-import gql from 'graphql-tag'
-import Head from 'next/head'
-import Router from 'next/router'
-import { useAuth } from '@core/next/auth'
-import { useIntl } from '@core/next/intl'
-import { useMutation } from '@core/next/apollo'
-
-import { TopMenuOnlyLayout } from '@app/ex02front/containers/BaseLayout'
-import { getQueryParams } from '@app/ex02front/utils/url.utils'
-import { runMutation } from '@app/ex02front/utils/mutations.utils'
-
-import { AuthState, PhoneAuthForm } from './register'
-
-let SIGNIN_BY_FIREBASE_ID_TOKEN_MUTATION = gql`
- mutation authenticateUserWithFirebaseIdToken ($token: String!) {
- obj: authenticateUserWithFirebaseIdToken(data: { firebaseIdToken: $token }) {
- item {
- id
- }
- }
- }
-`
-
-const SignInForm = ({ firebaseUser, children, ExtraErrorToFormFieldMsgMapping = {} }) => {
- const [form] = Form.useForm()
- const intl = useIntl()
- const [isLoading, setIsLoading] = useState(false)
- const { refetch } = useAuth()
- const [signin, ctx] = useMutation(SIGNIN_BY_FIREBASE_ID_TOKEN_MUTATION)
- let initialValues = getQueryParams()
- initialValues = { ...initialValues, password: '', confirm: '', captcha: 'no' }
-
- const SignInMsg = intl.formatMessage({ id: 'SignIn' })
- const RegisterMsg = intl.formatMessage({ id: 'Register' })
- const PasswordMsg = intl.formatMessage({ id: 'Password' })
- const ServerErrorMsg = intl.formatMessage({ id: 'ServerError' })
- const LoggedInMsg = intl.formatMessage({ id: 'pages.auth.LoggedIn' })
- const EmailIsNoFoundMsg = intl.formatMessage({ id: 'pages.auth.EmailIsNoFound' })
- const WrongPasswordMsg = intl.formatMessage({ id: 'pages.auth.WrongPassword' })
- const PleaseInputYourPasswordMsg = intl.formatMessage({ id: 'pages.auth.PleaseInputYourPassword' })
- const ForgotPasswordMsg = intl.formatMessage({ id: 'pages.auth.ForgotPassword' })
- const ErrorToFormFieldMsgMapping = {
- '[passwordAuth:identity:notFound]': {
- name: 'email',
- errors: [EmailIsNoFoundMsg],
- },
- '[passwordAuth:secret:mismatch]': {
- name: 'password',
- errors: [WrongPasswordMsg],
- },
- ...ExtraErrorToFormFieldMsgMapping,
- }
-
- const onFinish = values => {
- setIsLoading(true)
- return runMutation({
- mutation: signin,
- variables: {
- token: firebaseUser.token,
- },
- onCompleted: () => {
- refetch()
- if (initialValues.next) Router.push(initialValues.next)
- else Router.push('/')
- },
- onFinally: () => {
- setIsLoading(false)
- },
- intl,
- form,
- ErrorToFormFieldMsgMapping,
- OnCompletedMsg: LoggedInMsg,
- })
- }
-
- return (
-
-
-
-
-
- )
-}
-
-function SignInByPhoneForm () {
- const intl = useIntl()
- const FieldIsRequiredMsg = intl.formatMessage({ id: 'FieldIsRequired' })
- const PhoneIsAlreadyRegisteredMsg = intl.formatMessage({ id: 'pages.auth.PhoneIsAlreadyRegistered' })
- const PhoneMsg = intl.formatMessage({ id: 'Phone' })
- const ExtraErrorToFormFieldMsgMapping = {
- '[unique:importId:multipleFound]': {
- name: '_phone',
- errors: [PhoneIsAlreadyRegisteredMsg],
- },
- '[unique:phone:multipleFound]': {
- name: '_phone',
- errors: [PhoneIsAlreadyRegisteredMsg],
- },
- }
-
- return {
- return
-
- {PhoneMsg}{' '}
-
- }
- rules={[{ required: true, message: FieldIsRequiredMsg }]}
- key={user.phoneNumber}
- initialValue={user.phoneNumber}
- >
-
-
-
-
-
-
- }}/>
-}
-
-const SignInPage = () => {
- const intl = useIntl()
- const SignInTitleMsg = intl.formatMessage({ id: 'pages.auth.SignInTitle' })
- return (<>
-
- {SignInTitleMsg}
-
- {SignInTitleMsg}
-
-
-
- >)
-}
-
-SignInPage.container = TopMenuOnlyLayout
-export default SignInPage
diff --git a/apps/_demo/pages/index.jsx b/apps/_demo/pages/index.jsx
deleted file mode 100644
index d213d768..00000000
--- a/apps/_demo/pages/index.jsx
+++ /dev/null
@@ -1,31 +0,0 @@
-import { useIntl } from '@core/next/intl'
-import Head from 'next/head'
-import { Typography } from 'antd'
-import ReactMarkdown from 'react-markdown'
-
-import { PageContent, PageHeader, PageWrapper } from '@app/ex02front/containers/BaseLayout'
-import { OrganizationRequired } from '@app/ex02front/containers/OrganizationRequired'
-
-const IndexPage = () => {
- const intl = useIntl()
- const PageTitleMsg = intl.formatMessage({ id: 'pages.index.PageTitle' })
- const WeAreStillDevelopingThisPageMsg = intl.formatMessage({ id: 'WeAreStillDevelopingThisPage' })
-
- return <>
-
- {PageTitleMsg}
-
-
-
-
-
-
-
-
-
-
-
- >
-}
-
-export default IndexPage
diff --git a/apps/_demo/pages/organizations.jsx b/apps/_demo/pages/organizations.jsx
deleted file mode 100644
index 008e090c..00000000
--- a/apps/_demo/pages/organizations.jsx
+++ /dev/null
@@ -1,2 +0,0 @@
-import OrganizationsPage from '@app/ex02front/pages/organizations'
-export default OrganizationsPage
diff --git a/apps/_demo/pages/users.jsx b/apps/_demo/pages/users.jsx
deleted file mode 100644
index 9016dc75..00000000
--- a/apps/_demo/pages/users.jsx
+++ /dev/null
@@ -1,2 +0,0 @@
-import UsersPage from '@app/ex02front/pages/users'
-export default UsersPage
diff --git a/apps/_demo/public/favicon.ico b/apps/_demo/public/favicon.ico
deleted file mode 100644
index 7c3436d2..00000000
Binary files a/apps/_demo/public/favicon.ico and /dev/null differ
diff --git a/apps/_demo/public/logo.svg b/apps/_demo/public/logo.svg
deleted file mode 100644
index 8a8781dc..00000000
--- a/apps/_demo/public/logo.svg
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
diff --git a/apps/_demo/schema/Auth.js b/apps/_demo/schema/Auth.js
deleted file mode 100644
index ba4499c6..00000000
--- a/apps/_demo/schema/Auth.js
+++ /dev/null
@@ -1,76 +0,0 @@
-const { getById, getSchemaCtx } = require('@core/keystone/schema')
-const { GQLCustomSchema } = require('@core/keystone/schema')
-
-const { admin } = require('../utils/firebase.back.utils')
-
-const AuthenticateUserWithFirebaseIdTokenService = new GQLCustomSchema('AuthenticateUserWithFirebaseIdTokenService', {
- types: [
- {
- access: true,
- type: 'input AuthenticateUserWithFirebaseIdTokenInput { firebaseIdToken: String! }',
- },
- {
- access: true,
- type: 'type AuthenticateUserWithFirebaseIdTokenOutput { item: User }',
- },
- ],
- mutations: [
- {
- access: true,
- schema: 'authenticateUserWithFirebaseIdToken(data: AuthenticateUserWithFirebaseIdTokenInput!): AuthenticateUserWithFirebaseIdTokenOutput',
- resolver: async (parent, args, context, info, extra = {}) => {
- await AuthenticateUserWithFirebaseIdTokenService.emit('beforeAuthenticateUserWithFirebaseIdToken', {
- parent, args, context, info, extra,
- })
-
- const { data } = args
- const { firebaseIdToken } = data
- if (!firebaseIdToken) throw new Error('[error] no firebaseIdToken')
-
- const { uid, phone_number } = await admin.auth().verifyIdToken(firebaseIdToken)
-
- const { errors: findErrors, data: findData } = await context.executeGraphQL({
- context: context.createContext({ skipAccessControl: true }),
- query: `
- query findUserByImportId($uid: String!) {
- objs: allUsers(where: { importId: $uid }) {
- id
- importId
- email
- phone
- }
- }
- `,
- variables: { uid },
- })
-
- if (findErrors || !findData.objs || findData.objs.length !== 1 || !findData.objs[0].id) {
- const msg = '[notfound.error] Unable to find user. Try to register'
- console.error(msg, findErrors)
- throw new Error(msg)
- }
-
- const userData = findData.objs[0]
-
- if (userData.phone !== phone_number) {
- // TODO(pahaz): need to replace obj.phone by Firebase.phone_number
- }
-
- const { keystone } = await getSchemaCtx(AuthenticateUserWithFirebaseIdTokenService)
- await context.startAuthedSession({ item: userData, list: keystone.lists['User'] })
-
- const result = {
- item: await getById('User', userData.id),
- }
- await AuthenticateUserWithFirebaseIdTokenService.emit('afterAuthenticateUserWithFirebaseIdToken', {
- parent, args, context, info, extra, result,
- })
- return result
- },
- },
- ],
-})
-
-module.exports = {
- AuthenticateUserWithFirebaseIdTokenService,
-}
diff --git a/apps/_demo/schema/Organization.js b/apps/_demo/schema/Organization.js
deleted file mode 100644
index 89a657d8..00000000
--- a/apps/_demo/schema/Organization.js
+++ /dev/null
@@ -1,71 +0,0 @@
-const { Wysiwyg } = require('@keystonejs/fields-wysiwyg-tinymce')
-const { LocalFileAdapter } = require('@keystonejs/file-adapters')
-const { Text, File } = require('@keystonejs/fields')
-const { Organization: BaseOrganization, OrganizationToUserLink: BaseOrganizationToUserLink, RegisterNewOrganizationService: BaseRegisterNewOrganizationService, InviteNewUserToOrganizationService: BaseInviteNewUserToOrganizationService, AcceptOrRejectOrganizationInviteService } = require('@core/keystone/schemas/Organization')
-const conf = require('@core/config')
-const faker = require('faker')
-
-const AVATAR_FILE_ADAPTER = new LocalFileAdapter({
- src: `${conf.MEDIA_ROOT}/orgavatars`,
- path: `${conf.MEDIA_URL}/orgavatars`,
-})
-
-const Organization = BaseOrganization._override({
- fields: {
- // settings: { type: MultiCheck, options: ['Feature1', 'Feature2'] },
- avatar: { type: File, adapter: AVATAR_FILE_ADAPTER },
- description: {
- factory: () => faker.lorem.paragraph(),
- type: Wysiwyg,
- },
- },
-})
-
-const OrganizationToUserLink = BaseOrganizationToUserLink._override({
- fields: {
- phone: {
- factory: () => faker.phone.phoneNumberFormat(),
- type: Text,
- hooks: {
- resolveInput: async ({ resolvedData }) => {
- return resolvedData['phone'] && resolvedData['phone'].toLowerCase().replace(/\D/g, '')
- },
- },
- },
- },
-})
-
-const RegisterNewOrganizationService = BaseRegisterNewOrganizationService._override({
- types: [
- {
- access: true,
- type: 'input RegisterNewOrganizationInput { name: String!, description: String!, avatar: Upload }',
- },
- ],
-})
-
-RegisterNewOrganizationService.on('beforeRegisterNewOrganization', async ({ parent, args, context, info, extra }) => {
- extra.extraLinkData = { phone: context.authedItem.phone }
-})
-
-const InviteNewUserToOrganizationService = BaseInviteNewUserToOrganizationService._override({
- types: [
- {
- access: true,
- type: 'input InviteNewUserToOrganizationInput { organization: OrganizationWhereUniqueInput!, name: String, email: String!, phone: String }',
- },
- ],
-})
-
-InviteNewUserToOrganizationService.on('afterInviteNewUserToOrganization', ({ parent, args, context, info, extra, result }) => {
- // TODO(pahaz): show invite link! and create invite page (for not registered email)
- console.log('Fake send security email!', JSON.stringify(result))
-})
-
-module.exports = {
- Organization,
- OrganizationToUserLink,
- RegisterNewOrganizationService,
- InviteNewUserToOrganizationService,
- AcceptOrRejectOrganizationInviteService,
-}
diff --git a/apps/_demo/schema/Organization.test.js b/apps/_demo/schema/Organization.test.js
deleted file mode 100644
index d7510f74..00000000
--- a/apps/_demo/schema/Organization.test.js
+++ /dev/null
@@ -1,660 +0,0 @@
-/**
- * @jest-environment node
- */
-
-const { createSchemaObject, setFakeClientMode } = require('@core/keystone/test.utils')
-const { makeLoggedInClient, makeLoggedInAdminClient, makeClient, createUser, gql } = require('@core/keystone/test.utils')
-const conf = require('@core/config')
-const faker = require('faker')
-if (conf.TESTS_FAKE_CLIENT_MODE) setFakeClientMode(require.resolve('../index'))
-
-const { Organization, OrganizationToUserLink } = require('../schema/Organization')
-
-const ALL_ORGANIZATIONS_QUERY = gql`
- query {
- objs: allOrganizations {
- id
- name
- }
- }
-`
-
-const COUNT_OF_ORGANIZATIONS_QUERY = gql`
- query {
- meta: _allOrganizationsMeta {
- count
- }
- }
-`
-
-const ALL_ORGANIZATION_TO_USER_LINKS_QUERY = gql`
- query {
- objs: allOrganizationToUserLinks {
- id
- user {
- id
- name
- }
- organization {
- id
- name
- }
- }
- }
-`
-
-const COUNT_OF_ORGANIZATION_TO_USER_LINKS_QUERY = gql`
- query {
- meta: _allOrganizationToUserLinksMeta {
- count
- }
- }
-`
-
-const GET_ORGANIZATION_WITH_LINKS_QUERY = gql`
- query q($id: ID!) {
- obj: Organization (where: {id: $id}) {
- id
- userLinks {
- organization {
- id
- }
- user {
- id
- }
- role
- id
- }
- }
- }
-`
-
-const REGISTER_NEW_ORGANIZATION_MUTATION = gql`
- mutation reg($data: RegisterNewOrganizationInput!) {
- obj: registerNewOrganization(data: $data) {
- id
- userLinks {
- id
- organization {
- id
- name
- description
- }
- user {
- id
- }
- role
- }
- }
- }
-`
-
-const DELETE_ORGANIZATION_TO_USER_LINK_MUTATION = gql`
- mutation delObj($id: ID!) {
- obj: deleteOrganizationToUserLink(id: $id) {
- id
- role
- }
- }
-`
-
-const UPDATE_ORGANIZATION_TO_USER_LINK_MUTATION = gql`
- mutation update($id: ID!, $data: OrganizationToUserLinkUpdateInput){
- obj: updateOrganizationToUserLink(id: $id, data: $data) {
- id
- organization {
- id
- }
- user {
- id
- }
- role
- }
- }
-`
-
-const GET_ORGANIZATION_TO_USER_LINK_CODE_BY_ID_QUERY = gql`
- query getCode($id: ID!){
- obj: OrganizationToUserLink(where: {id: $id}) {
- id
- code
- }
- }
-`
-
-test('anonymous: get all Organizations', async () => {
- const client = await makeClient()
- const { data, errors } = await client.query(ALL_ORGANIZATIONS_QUERY)
- expect(errors[0]).toMatchObject({
- 'data': { 'target': 'allOrganizations', 'type': 'query' },
- 'message': 'You do not have access to this resource',
- 'name': 'AccessDeniedError',
- 'path': ['objs'],
- })
- expect(data).toEqual({ 'objs': null })
-})
-
-test('anonymous: get count of Organizations', async () => {
- const client = await makeClient()
- const { data, errors } = await client.query(COUNT_OF_ORGANIZATIONS_QUERY)
- expect(errors[0]).toMatchObject({
- 'data': { 'target': '_allOrganizationsMeta', 'type': 'query' },
- 'message': 'You do not have access to this resource',
- 'name': 'AccessDeniedError',
- 'path': ['meta', 'count'],
- })
- expect(data).toEqual({ meta: { count: null } })
-})
-
-test('user: get all Organizations', async () => {
- await createSchemaObject(Organization)
- const user = await createUser()
- const client = await makeLoggedInClient(user)
- const { data, errors } = await client.query(ALL_ORGANIZATIONS_QUERY)
- expect(errors).toEqual(undefined)
- expect(data.objs.length).toBeGreaterThan(0)
-})
-
-test('user: get count of Organizations', async () => {
- await createSchemaObject(Organization)
- const user = await createUser()
- const client = await makeLoggedInClient(user)
- const { data } = await client.query(COUNT_OF_ORGANIZATIONS_QUERY)
- expect(data.meta.count).toBeGreaterThan(0)
-})
-
-test('anonymous: get all OrganizationToUserLinks', async () => {
- const client = await makeClient()
- const { data, errors } = await client.query(ALL_ORGANIZATION_TO_USER_LINKS_QUERY)
- expect(errors[0]).toMatchObject({
- 'data': { 'target': 'allOrganizationToUserLinks', 'type': 'query' },
- 'message': 'You do not have access to this resource',
- 'name': 'AccessDeniedError',
- 'path': ['objs'],
- })
- expect(data).toEqual({ 'objs': null })
-})
-
-test('anonymous: get count of OrganizationToUserLinks', async () => {
- const client = await makeClient()
- const { data, errors } = await client.query(COUNT_OF_ORGANIZATION_TO_USER_LINKS_QUERY)
- expect(errors[0]).toMatchObject({
- 'data': { 'target': '_allOrganizationToUserLinksMeta', 'type': 'query' },
- 'message': 'You do not have access to this resource',
- 'name': 'AccessDeniedError',
- 'path': ['meta', 'count'],
- })
- expect(data).toEqual({ meta: { count: null } })
-})
-
-test('user: get all OrganizationToUserLinks', async () => {
- await createSchemaObject(OrganizationToUserLink)
- const user = await createUser()
- const client = await makeLoggedInClient(user)
- const { data, errors } = await client.query(ALL_ORGANIZATION_TO_USER_LINKS_QUERY)
- expect(errors).toEqual(undefined)
- expect(data.objs).toHaveLength(0)
-})
-
-test('user: get count of OrganizationToUserLinks', async () => {
- await createSchemaObject(OrganizationToUserLink)
- const user = await createUser()
- const client = await makeLoggedInClient(user)
- const { data } = await client.query(COUNT_OF_ORGANIZATION_TO_USER_LINKS_QUERY)
- expect(data.meta.count).toEqual(0)
-})
-
-test('user: hide OrganizationToUserLink for everyone who not in userLinks', async () => {
- await createSchemaObject(OrganizationToUserLink)
- const { id, _raw_query_data } = await createSchemaObject(OrganizationToUserLink)
- const organization = _raw_query_data.organization.create
- const user = _raw_query_data.user.create
- expect(user.email).toMatch(/^.+$/g)
- expect(user.password).toMatch(/^.+$/g)
- expect(organization.name).toMatch(/^.+$/g)
-
- // check by member
- const client_member = await makeLoggedInClient(user)
- const { data: data1, errors: errors1 } = await client_member.query(ALL_ORGANIZATION_TO_USER_LINKS_QUERY)
- expect(errors1).toEqual(undefined)
- expect(data1.objs).toEqual([expect.objectContaining({
- id,
- user: expect.objectContaining({ id: client_member.user.id }),
- organization: expect.objectContaining({ name: organization.name }),
- })])
-
- const { data: data2, errors: errors2 } = await client_member.query(COUNT_OF_ORGANIZATION_TO_USER_LINKS_QUERY)
- expect(errors2).toEqual(undefined)
- expect(data2.meta.count).toEqual(1)
-})
-
-test('user: access to change OrganizationToUserLink only for owners', async () => {
- const user1 = await createUser()
- const user2 = await createUser()
- const user3 = await createUser()
- const { id: organizationId } = await createSchemaObject(Organization)
- const { id: link1Id } = await createSchemaObject(OrganizationToUserLink, {
- organization: { connect: { id: organizationId } },
- user: { connect: { id: user1.id } },
- role: 'owner',
- })
- const { id: link2Id } = await createSchemaObject(OrganizationToUserLink, {
- organization: { connect: { id: organizationId } },
- user: { connect: { id: user2.id } },
- role: 'member',
- })
- const { id: link3Id } = await createSchemaObject(OrganizationToUserLink, {
- organization: { connect: { id: organizationId } },
- user: { connect: { id: user3.id } },
- role: 'member',
- })
- const client_owner = await makeLoggedInClient(user1)
-
- // check DB state
- const { data: data0, errors: errors0 } = await client_owner.query(GET_ORGANIZATION_WITH_LINKS_QUERY, { id: organizationId })
- expect(errors0).toEqual(undefined)
- expect(data0.obj).toEqual({
- 'id': organizationId,
- 'userLinks': [
- {
- 'id': link1Id,
- 'organization': {
- 'id': organizationId,
- },
- 'role': 'owner',
- 'user': {
- 'id': user1.id,
- },
- },
- {
- 'id': link2Id,
- 'organization': {
- 'id': organizationId,
- },
- 'role': 'member',
- 'user': {
- 'id': user2.id,
- },
- },
- {
- 'id': link3Id,
- 'organization': {
- 'id': organizationId,
- },
- 'role': 'member',
- 'user': {
- 'id': user3.id,
- },
- },
- ],
- })
-
- // delete user 3
- const { data: data2, errors: errors2 } = await client_owner.mutate(DELETE_ORGANIZATION_TO_USER_LINK_MUTATION, { id: link3Id })
- expect(errors2).toEqual(undefined)
- expect(data2.obj).toEqual(expect.objectContaining({ id: link3Id }))
-
- const client_member = await makeLoggedInClient(user2)
- const { data: data3, errors: errors3 } = await client_member.query(GET_ORGANIZATION_WITH_LINKS_QUERY, { id: organizationId })
- expect(errors3).toEqual(undefined)
- expect(data3.obj).toEqual({
- 'id': organizationId,
- 'userLinks': [
- {
- 'id': link1Id,
- 'organization': {
- 'id': organizationId,
- },
- 'role': 'owner',
- 'user': {
- 'id': user1.id,
- },
- },
- {
- 'id': link2Id,
- 'organization': {
- 'id': organizationId,
- },
- 'role': 'member',
- 'user': {
- 'id': user2.id,
- },
- },
- ],
- })
-
- // try to delete user 1
- const { data: data4, errors: errors4 } = await client_member.mutate(DELETE_ORGANIZATION_TO_USER_LINK_MUTATION, { id: link1Id })
- expect(errors4[0]).toMatchObject({
- 'data': { 'target': 'deleteOrganizationToUserLink', 'type': 'mutation' },
- 'message': 'You do not have access to this resource',
- 'name': 'AccessDeniedError',
- 'path': ['obj'],
- })
- expect(data4).toEqual({ 'obj': null })
-})
-
-test('registerNewOrganization() by user', async () => {
- const user = await createUser()
- const client = await makeLoggedInClient(user)
- const name = faker.company.companyName()
- const description = faker.lorem.paragraph()
- const { data, errors } = await client.mutate(REGISTER_NEW_ORGANIZATION_MUTATION, {
- data: { name, description },
- })
-
- // created company
- expect(errors).toEqual(undefined)
- expect(data.obj.id).toMatch(/^[0-9a-zA-Z-_]+$/)
- expect(data.obj.userLinks).toEqual([
- expect.objectContaining({
- 'organization': expect.objectContaining({ name, description }),
- 'user': { 'id': user.id },
- 'role': 'owner',
- }),
- ])
-})
-
-test('no access to change another organization', async () => {
- const { id: organizationId } = await createSchemaObject(Organization)
- const { id: linkId } = await createSchemaObject(OrganizationToUserLink, {
- organization: { connect: { id: organizationId } },
- role: 'owner',
- })
-
- const user = await createUser()
- const client = await makeLoggedInClient(user)
- const { errors } = await client.mutate(REGISTER_NEW_ORGANIZATION_MUTATION, {
- data: { name: faker.company.companyName(), description: faker.lorem.paragraph() },
- })
- expect(errors).toEqual(undefined)
-
- const { errors: err1 } = await client.mutate(UPDATE_ORGANIZATION_TO_USER_LINK_MUTATION, {
- id: linkId,
- data: { user: { connect: { id: user.id } } },
- })
- expect(err1[0]).toMatchObject({
- 'data': { 'target': 'updateOrganizationToUserLink', 'type': 'mutation' },
- 'message': 'You do not have access to this resource',
- 'name': 'AccessDeniedError',
- 'path': ['obj'],
- })
- const { errors: err2 } = await client.mutate(UPDATE_ORGANIZATION_TO_USER_LINK_MUTATION, {
- id: linkId,
- data: { role: 'member' },
- })
- expect(err2[0]).toMatchObject({
- 'data': { 'target': 'updateOrganizationToUserLink', 'type': 'mutation' },
- 'message': 'You do not have access to this resource',
- 'name': 'AccessDeniedError',
- 'path': ['obj'],
- })
-})
-
-const INVITE_NEW_USER_MUTATION = gql`
- mutation inviteNewUser($data: InviteNewUserToOrganizationInput!) {
- obj: inviteNewUserToOrganization(data: $data) {
- id
- role
- user {
- id
- }
- }
- }
-`
-
-async function inviteNewUser (client, organizationId, email) {
- const { data, errors } = await client.mutate(INVITE_NEW_USER_MUTATION, {
- data: {
- organization: { id: organizationId },
- email: email,
- name: 'user2',
- },
- })
- expect(errors).toEqual(undefined)
- expect(data.obj.id).toMatch(/^[0-9a-zA-Z-_]+$/)
- expect(data.obj.role).toEqual('member')
- return { data }
-}
-
-test('owner: invite new user', async () => {
- const user = await createUser()
- const user2 = await createUser()
- const client = await makeLoggedInClient(user)
- const { data, errors } = await client.mutate(REGISTER_NEW_ORGANIZATION_MUTATION, {
- data: { name: faker.company.companyName(), description: faker.lorem.paragraph() },
- })
- expect(errors).toEqual(undefined)
-
- // invite
- const { data: d2 } = await inviteNewUser(client, data.obj.id, user2.email)
- expect(d2.obj.user.id).toEqual(user2.id)
-})
-
-test('owner: try to invite already invited user', async () => {
- const user = await createUser()
- const user2 = await createUser()
- const client = await makeLoggedInClient(user)
- const { data, errors } = await client.mutate(REGISTER_NEW_ORGANIZATION_MUTATION, {
- data: { name: faker.company.companyName(), description: faker.lorem.paragraph() },
- })
- expect(errors).toEqual(undefined)
-
- // invite
- await inviteNewUser(client, data.obj.id, user2.email)
- {
- const { errors } = await client.mutate(INVITE_NEW_USER_MUTATION, {
- data: {
- organization: { id: data.obj.id },
- email: user2.email,
- name: 'user2',
- },
- })
- expect(JSON.stringify(errors)).toContain('[error.already.exists]')
- }
-})
-
-test('owner: try to invite already invited email', async () => {
- const user = await createUser()
- const client = await makeLoggedInClient(user)
- const { data, errors } = await client.mutate(REGISTER_NEW_ORGANIZATION_MUTATION, {
- data: { name: faker.company.companyName(), description: faker.lorem.paragraph() },
- })
- expect(errors).toEqual(undefined)
-
- // invite
- await inviteNewUser(client, data.obj.id, 'xm2' + user.email)
- {
- const { errors } = await client.mutate(INVITE_NEW_USER_MUTATION, {
- data: {
- organization: { id: data.obj.id },
- email: 'xm2' + user.email,
- name: 'user2',
- },
- })
- expect(JSON.stringify(errors)).toContain('[error.already.exists]')
- }
-})
-
-test('owner: has access to invite/update/delete OrganizationToUserLinks', async () => {
- const user = await createUser()
- const user2 = await createUser()
- const client = await makeLoggedInClient(user)
- const { data, errors } = await client.mutate(REGISTER_NEW_ORGANIZATION_MUTATION, {
- data: { name: faker.company.companyName(), description: faker.lorem.paragraph() },
- })
- expect(errors).toEqual(undefined)
-
- const { data: d2 } = await inviteNewUser(client, data.obj.id, user2.email)
-
- // update
- const { data: d3, errors: err3 } = await client.mutate(UPDATE_ORGANIZATION_TO_USER_LINK_MUTATION, {
- id: d2.obj.id,
- data: {
- role: 'owner',
- },
- })
- expect(err3).toEqual(undefined)
- expect(d3.obj.role).toEqual('owner')
-
- // delete
- const { data: d4, errors: err4 } = await client.mutate(DELETE_ORGANIZATION_TO_USER_LINK_MUTATION, {
- id: d2.obj.id,
- })
- expect(err4).toEqual(undefined)
- expect(d4.obj.id).toEqual(d2.obj.id)
-})
-
-test('owner: has no access to update OrganizationToUserLinks organization/user attrs', async () => {
- const { id: organizationId } = await createSchemaObject(Organization)
- const user = await createUser()
- const user2 = await createUser()
- const client = await makeLoggedInClient(user)
- const { data, errors } = await client.mutate(REGISTER_NEW_ORGANIZATION_MUTATION, {
- data: { name: faker.company.companyName(), description: faker.lorem.paragraph() },
- })
- expect(errors).toEqual(undefined)
-
- const { data: d2 } = await inviteNewUser(client, data.obj.id, user2.email)
-
- // update organization
- const { errors: err3 } = await client.mutate(UPDATE_ORGANIZATION_TO_USER_LINK_MUTATION, {
- id: d2.obj.id,
- data: {
- organization: { connect: { id: organizationId } },
- },
- })
- expect(err3[0]).toMatchObject({
- 'data': { 'target': 'updateOrganizationToUserLink', 'type': 'mutation' },
- 'message': 'You do not have access to this resource',
- 'name': 'AccessDeniedError',
- 'path': ['obj'],
- })
- // update user
- const { errors: err4 } = await client.mutate(UPDATE_ORGANIZATION_TO_USER_LINK_MUTATION, {
- id: d2.obj.id,
- data: {
- user: { connect: { id: user2.id } },
- },
- })
- expect(err4[0]).toMatchObject({
- 'data': { 'target': 'updateOrganizationToUserLink', 'type': 'mutation' },
- 'message': 'You do not have access to this resource',
- 'name': 'AccessDeniedError',
- 'path': ['obj'],
- })
-})
-
-const ACCEPT_OR_REJECT_BY_ID_MUTATION = gql`
- mutation acceptOrReject($id: ID!, $data: AcceptOrRejectOrganizationInviteInput!){
- obj: acceptOrRejectOrganizationInviteById(id: $id, data: $data) {
- id isAccepted isRejected
- }
- }
-`
-
-const ACCEPT_OR_REJECT_BY_CODE_MUTATION = gql`
- mutation acceptOrReject($code: String!, $data: AcceptOrRejectOrganizationInviteInput!){
- obj: acceptOrRejectOrganizationInviteByCode(code: $code, data: $data) {
- id isAccepted isRejected
- }
- }
-`
-
-// TODO(pahaz): check antonymous ACCEPT_OR_REJECT_BY_ID_MUTATION
-
-test('user: accept/reject OrganizationToUserLinks by ID', async () => {
- const user = await createUser()
- const user2 = await createUser()
- const client = await makeLoggedInClient(user)
- const { data, errors } = await client.mutate(REGISTER_NEW_ORGANIZATION_MUTATION, {
- data: { name: faker.company.companyName(), description: faker.lorem.paragraph() },
- })
- expect(errors).toEqual(undefined)
-
- // create
- const { data: d2 } = await inviteNewUser(client, data.obj.id, user2.email)
-
- // accept
- const member_client = await makeLoggedInClient(user2)
- const { data: d3, errors: err3 } = await member_client.mutate(ACCEPT_OR_REJECT_BY_ID_MUTATION, {
- id: d2.obj.id,
- data: {
- isAccepted: true,
- },
- })
- expect(err3).toEqual(undefined)
- expect(d3.obj).toEqual({
- id: d2.obj.id,
- isAccepted: true,
- isRejected: false,
- })
-
- // reject
- const { data: d4, errors: err4 } = await member_client.mutate(ACCEPT_OR_REJECT_BY_ID_MUTATION, {
- id: d2.obj.id,
- data: {
- isRejected: true,
- },
- })
- expect(err4).toEqual(undefined)
- expect(d4.obj).toEqual({
- id: d2.obj.id,
- isAccepted: false,
- isRejected: true,
- })
-})
-
-async function getInviteCode (id) {
- const admin = await makeLoggedInAdminClient()
- const { data, errors } = await admin.query(GET_ORGANIZATION_TO_USER_LINK_CODE_BY_ID_QUERY, { id })
- expect(errors).toEqual(undefined)
- expect(data.obj.id).toEqual(id)
- console.log(data)
- return data.obj.code
-}
-
-test('user: accept/reject OrganizationToUserLinks by CODE', async () => {
- const user = await createUser()
- const client = await makeLoggedInClient(user)
- const { data, errors } = await client.mutate(REGISTER_NEW_ORGANIZATION_MUTATION, {
- data: { name: faker.company.companyName(), description: faker.lorem.paragraph() },
- })
- expect(errors).toEqual(undefined)
-
- // create
- const { data: d2 } = await inviteNewUser(client, data.obj.id, 'x2' + user.email)
- expect(d2.obj.user).toBeNull()
-
- const code = await getInviteCode(d2.obj.id)
-
- // accept
- const user2 = await createUser()
- const member_client = await makeLoggedInClient(user2)
- const { data: d3, errors: err3 } = await member_client.mutate(ACCEPT_OR_REJECT_BY_CODE_MUTATION, {
- code,
- data: {
- isAccepted: true,
- },
- })
- expect(err3).toEqual(undefined)
- expect(d3.obj).toEqual({
- id: d2.obj.id,
- isAccepted: true,
- isRejected: false,
- })
-
- // second time!
- const { errors: err4 } = await member_client.mutate(ACCEPT_OR_REJECT_BY_CODE_MUTATION, {
- code,
- data: {
- isAccepted: true,
- },
- })
- expect(err4[0]).toMatchObject({
- 'data': { 'target': 'acceptOrRejectOrganizationInviteByCode', 'type': 'mutation' },
- 'message': 'You do not have access to this resource',
- 'name': 'AccessDeniedError',
- 'path': ['obj'],
- })
-})
diff --git a/apps/_demo/schema/Test.js b/apps/_demo/schema/Test.js
deleted file mode 100644
index fb0922ea..00000000
--- a/apps/_demo/schema/Test.js
+++ /dev/null
@@ -1,183 +0,0 @@
-const { historical, versioned, uuided, tracked, softDeleted } = require('@core/keystone/plugins')
-const {
- Checkbox,
- Decimal,
- Float,
- Integer,
- Select,
- Slug,
- Url,
- Uuid,
- Text,
- Relationship,
- DateTimeUtc,
- DateTime,
- CalendarDay,
- File,
- Password,
- Virtual,
-} = require('@keystonejs/fields')
-const { Content } = require('@keystonejs/fields-content')
-const { GQLListSchema } = require('@core/keystone/schema')
-const { Color } = require('@keystonejs/fields-color')
-const { LocationGoogle } = require('@keystonejs/fields-location-google')
-const { v4: uuid } = require('uuid')
-const { Stars, Options, Json, AutoIncrementInteger } = require('@core/keystone/fields')
-const { LocalFileAdapter } = require('@keystonejs/file-adapters')
-const conf = require('@core/config')
-
-const adapter = new LocalFileAdapter({
- src: `${conf.MEDIA_ROOT}/test`,
- path: `${conf.MEDIA_URL}/test`,
-})
-
-const Test = new GQLListSchema('Test', {
- fields: {
- date1: { type: DateTime },
- utc: { type: DateTimeUtc },
- day: { type: CalendarDay },
- file: { type: File, adapter },
- pass: { type: Password },
- vir1: {
- type: Virtual,
- access: { create: false, update: false, delete: false, read: true },
- resolver: (item) => item.day ? '!' : 'no date!',
- },
-
- heroColor: { type: Color },
-
- isEnabled: { type: Checkbox, isRequired: true, defaultValue: false },
-
- body: {
- type: Content,
- blocks: [
- Content.blocks.blockquote,
- Content.blocks.image,
- Content.blocks.link,
- Content.blocks.orderedList,
- Content.blocks.unorderedList,
- Content.blocks.heading,
- ],
- },
-
- rating1: { type: Integer, isRequired: true, defaultValue: 3 },
- rating2: { type: Float },
- rating3: { type: Decimal },
- venue: {
- type: LocationGoogle,
- googleMapsKey: 'no',
- },
-
- status_renamed: { type: Select, options: 'pending, processed, no', isRequired: true, defaultValue: 'no' },
- uuid: {
- type: Uuid,
- isRequired: true,
- defaultValue: () => uuid(),
- },
- url: {
- type: Url,
- isRequired: true,
- defaultValue: 'scheme:[//authority]path[?query][#fragment]',
- },
- slug: {
- type: Slug,
- isRequired: true,
- from: 'id',
- },
- users: {
- type: Relationship,
- ref: 'User',
- many: true,
- },
- self: {
- type: Relationship,
- ref: 'Test',
- many: false,
- },
- related: {
- type: Relationship,
- ref: 'Test',
- many: true,
- },
-
- rating: { type: Stars, starCount: 5 },
- settings: { type: Options, options: ['Feature1', 'Feature2'] },
- meta: { type: Json },
- text: { type: Text },
- item: {
- type: Relationship,
- ref: 'TestItem',
- },
- },
- access: {
- read: true,
- create: true,
- update: true,
- delete: true,
- auth: true,
- },
- plugins: [versioned(), tracked(), historical()],
-})
-
-const TestItem = new GQLListSchema('TestItem', {
- fields: {
- test: {
- type: Relationship,
- ref: 'Test',
- isRequired: true,
- },
- meta: {
- type: Json,
- defaultValue: {},
- isRequired: true,
- },
- },
- access: {
- read: true,
- create: true,
- update: true,
- delete: true,
- auth: true,
- },
- plugins: [uuided(), versioned(), tracked(), historical()],
-})
-
-const TestSoftDeletedObj = new GQLListSchema('TestSoftDeletedObj', {
- fields: {
- meta: {
- type: Json,
- },
- },
- access: {
- read: true,
- create: true,
- update: true,
- delete: true,
- auth: true,
- },
- plugins: [versioned(), tracked(), softDeleted(), historical()]
-})
-
-const TestAutoIncrementNumber = new GQLListSchema('TestAutoIncrementNumber', {
- fields: {
- number: {
- type: AutoIncrementInteger,
- isRequired: false,
- kmigratorOptions: { unique: true, null: false },
- },
- },
- access: {
- read: true,
- create: true,
- update: true,
- delete: true,
- auth: true,
- },
-})
-
-module.exports = {
- Test,
- TestItem,
- TestSoftDeletedObj,
- TestAutoIncrementNumber,
-}
diff --git a/apps/_demo/schema/Test.test.js b/apps/_demo/schema/Test.test.js
deleted file mode 100644
index 499323cb..00000000
--- a/apps/_demo/schema/Test.test.js
+++ /dev/null
@@ -1,420 +0,0 @@
-/**
- * @jest-environment node
- */
-
-const conf = require('@core/config')
-const { setFakeClientMode } = require('@core/keystone/test.utils')
-if (conf.TESTS_FAKE_CLIENT_MODE) setFakeClientMode(require.resolve('../index'))
-
-const faker = require('faker')
-const { isMongo } = require('@core/keystone/test.utils')
-const { makeClient, makeLoggedInClient, makeLoggedInAdminClient } = require('@core/keystone/test.utils')
-const { genTestGQLUtils } = require('@core/keystone/gen.gql.utils')
-const { UUID_RE, DATETIME_RE } = require('@core/keystone/test.utils')
-
-const TEST_FIELDS = '{ id v text meta createdAt updatedAt createdBy { id } updatedBy { id } }'
-const TEST_ITEM_FIELDS = `{ id v meta test ${TEST_FIELDS} }`
-const Test = genTestGQLUtils('Test', TEST_FIELDS)
-const TestItem = genTestGQLUtils('TestItem', TEST_ITEM_FIELDS)
-
-const TEST_HISTORY_FIELDS = '{ id v text history_id history_action history_date }'
-const TEST_ITEM_HISTORY_FIELDS = '{ id v meta test history_id history_action history_date }'
-const TestHistoryRecord = genTestGQLUtils('TestHistoryRecord', TEST_HISTORY_FIELDS)
-const TestItemHistoryRecord = genTestGQLUtils('TestItemHistoryRecord', TEST_ITEM_HISTORY_FIELDS)
-
-const TEST_SOFT_DELETED_FIELDS = '{ id v meta deletedAt }'
-const TestSoftDeletedObj = genTestGQLUtils('TestSoftDeletedObj', TEST_SOFT_DELETED_FIELDS)
-
-const TestAutoIncrementNumber = genTestGQLUtils('TestAutoIncrementNumber', '{ id number }')
-
-describe('Json field', () => {
- async function testJsonValue (value) {
- const client = await makeClient()
- let obj = await Test.create(client, { meta: value })
- expect(obj.meta).toStrictEqual(value)
- }
-
- test('object as value', async () => {
- await testJsonValue({ foo: 'foo', bar: 2, buz: false, no: null, yes: true })
- })
- test('object with array as value', async () => {
- if (isMongo()) return console.error('SKIP() Mongo: {} === null!')
-
- await testJsonValue({
- foo: ['foo', 1, 33.3],
- bar: 2,
- buz: false,
- no: [null, false],
- yes: true,
- e1: [],
- e2: {},
- })
- })
- test('{} as value', async () => {
- if (isMongo()) return console.error('SKIP() Mongo: {} === null!')
- await testJsonValue({})
- })
- test('null as value', async () => {
- await testJsonValue(null)
- })
- test('true as value', async () => {
- await testJsonValue(true)
- })
- test('false as value', async () => {
- await testJsonValue(false)
- })
- test('"" as value', async () => {
- await testJsonValue('')
- })
- test('[] as value', async () => {
- await testJsonValue([])
- })
- test('0 as value', async () => {
- await testJsonValue(0)
- })
- test('{"":[{}]} as value', async () => {
- await testJsonValue({ '': [{}] })
- await testJsonValue({ '': [{ '': [{}] }] })
- })
- test('number as value', async () => {
- await testJsonValue(faker.random.number())
- await testJsonValue(faker.random.float())
- })
- test('string as value', async () => {
- await testJsonValue(faker.internet.email())
- await testJsonValue(JSON.stringify(JSON.stringify(faker.internet.email())))
- await testJsonValue('\'')
- await testJsonValue('"')
- await testJsonValue('--')
- await testJsonValue('%')
- await testJsonValue('~')
- await testJsonValue('~~')
- })
- test('array as value', async () => {
- await testJsonValue(faker.random.arrayElements())
- })
-})
-
-describe('Json field exact match filter', () => {
- async function testFilterByValue (value, metaSuffix = '') {
- // NOTE: the test may fail by access denied to createdBy { id } field!
- const client = await makeLoggedInClient()
- const obj = await Test.create(client, { meta: value })
- const objs = await Test.getAll(client, { ['meta' + metaSuffix]: value })
- const objsIds = objs.map(x => x.id)
- const objsMetas = [...(new Set(objs.map(x => JSON.stringify(x.meta))))].map(JSON.parse)
- expect(objsIds).toContain(obj.id)
- expect(objsMetas).toStrictEqual([value])
- }
-
- test('object as value', async () => {
- if (isMongo()) return console.error('SKIP() Mongo: need a custom query parser!')
-
- await testFilterByValue({ foo: 'foo', bar: 2, buz: false, no: null, yes: true })
- // await testFilterByValue({ foo: 'foo', bar: 2, buz: false, no: null, yes: true }, '_in') // ok
- })
- test('object with array as value', async () => {
- if (isMongo()) return console.error('SKIP() Mongo: need a custom query parser!')
-
- await testFilterByValue({
- foo: ['foo', 1, 33.3],
- bar: 2,
- buz: false,
- no: [null, false],
- yes: true,
- e1: [],
- e2: {},
- })
- // await testFilterByValue({
- // foo: ['foo', 1, 33.3],
- // bar: 2,
- // buz: false,
- // no: [null, false],
- // yes: true,
- // e1: [],
- // e2: {},
- // },
- // '_in',
- // ) // ok
- })
- test('{} as value', async () => {
- if (isMongo()) return console.error('SKIP() Mongo: {} === null!')
-
- await testFilterByValue({})
- // await testFilterByValue({}, '_in') // ok
- })
- test('null as value', async () => {
- await testFilterByValue(null)
- // await testFilterByValue(null, '_in') // err
- })
- test('true as value', async () => {
- await testFilterByValue(true)
- // await testFilterByValue(true, '_in') // err
- })
- test('false as value', async () => {
- await testFilterByValue(false)
- // await testFilterByValue(false, '_in') // ok
- })
- test('by ""', async () => {
- await testFilterByValue('')
- // await testFilterByValue('', '_in') // ok
- })
- test('by []', async () => {
- await testFilterByValue([])
- // await testFilterByValue([], '_in') // err
- })
- test('by 0', async () => {
- await testFilterByValue(0)
- })
- test('by {"":[{}]}', async () => {
- if (isMongo()) return console.error('SKIP() Mongo: {} === null!')
-
- await testFilterByValue({ '': [{}] })
- await testFilterByValue({ '': [{ '': [{}] }] })
- })
- test('by number', async () => {
- await testFilterByValue(faker.random.number())
- await testFilterByValue(faker.random.float())
- })
- test('by string', async () => {
- await testFilterByValue(faker.internet.email())
- await testFilterByValue(JSON.stringify(JSON.stringify(faker.internet.email())))
- await testFilterByValue('\'')
- await testFilterByValue('"')
- await testFilterByValue('--')
- await testFilterByValue('%')
- await testFilterByValue('~')
- await testFilterByValue('~~')
- })
- test('by array', async () => {
- await testFilterByValue(faker.random.arrayElements())
- })
-})
-
-describe('historical()', () => {
- test('create/update/delete history', async () => {
- const client = await makeClient()
- let obj = await Test.create(client, {})
- await Test.update(client, obj.id, { text: 'hello' })
- await Test.update(client, obj.id, { text: 'no' })
- await Test.delete(client, obj.id)
-
- let histObjs = await TestHistoryRecord.getAll(client, { history_id: obj.id })
- expect(histObjs).toEqual([
- expect.objectContaining({ history_action: 'c', history_id: obj.id, text: null, v: 1 }),
- expect.objectContaining({ history_action: 'u', history_id: obj.id, text: 'hello', v: 2 }),
- expect.objectContaining({ history_action: 'u', history_id: obj.id, text: 'no', v: 3 }),
- expect.objectContaining({ history_action: 'd', history_id: obj.id, text: 'no', v: 3 }),
- ])
- })
-
- test('delete related object and set FK null without history update', async () => {
- if (isMongo()) return console.error('SKIP() Mongo: doesn\'t support UUID fk!')
- const client = await makeClient()
- let obj = await TestItem.create(client, { test: { create: { text: 'new1' } }, meta: { foo: 1 } })
- await TestItem.update(client, obj.id, { meta: { foo: 2 } })
- await Test.update(client, obj.test.id, { text: 'new2' })
- await Test.delete(client, obj.test.id)
- await TestItem.delete(client, obj.id)
-
- let histObjs = await TestHistoryRecord.getAll(client, { history_id: obj.test.id })
- expect(histObjs).toEqual([
- expect.objectContaining({ history_action: 'c', history_id: obj.test.id, text: 'new1', v: 1 }),
- expect.objectContaining({ history_action: 'u', history_id: obj.test.id, text: 'new2', v: 2 }),
- expect.objectContaining({ history_action: 'd', history_id: obj.test.id, text: 'new2', v: 2 }),
- ])
-
- histObjs = await TestItemHistoryRecord.getAll(client, { history_id: obj.id })
- expect(histObjs).toEqual([
- expect.objectContaining({
- history_action: 'c',
- history_id: obj.id,
- meta: { foo: 1 },
- v: 1,
- test: String(obj.test.id),
- }),
- expect.objectContaining({
- history_action: 'u',
- history_id: obj.id,
- meta: { foo: 2 },
- v: 2,
- test: String(obj.test.id),
- }),
- expect.objectContaining({
- history_action: 'd',
- history_id: obj.id,
- meta: { foo: 2 },
- v: 2,
- test: null,
- }),
- ])
- })
-})
-
-describe('versioned()', () => {
- test('check v field autoincrement', async () => {
- const client = await makeClient()
-
- let obj = await Test.create(client, {})
- expect(obj.v).toBe(1)
-
- obj = await Test.update(client, obj.id, { text: 'hello' })
- expect(obj.v).toBe(2)
- })
- test('try to set v', async () => {
- const admin = await makeLoggedInAdminClient()
- const { data, errors } = await Test.create(admin, { v: 5 }, { raw: true })
- expect(data).toEqual(undefined)
- expect(JSON.stringify(errors)).toMatch(/Field [\\"']+v[\\"']+ is not defined by type [\\"']+TestCreateInput[\\"']+/i)
- })
-})
-
-describe('uuided()', () => {
- test('chek id field is uuid', async () => {
- const client = await makeClient()
- let obj = await TestItem.create(client, { test: { create: { text: 'autoGen' } } })
- expect(obj.id).toMatch(UUID_RE)
- })
-})
-
-describe('tracked()', () => {
- test('check createAt/updateAt for anonymous', async () => {
- const client = await makeClient()
- let { id, createdAt, updatedAt } = await Test.create(client, {})
- expect(createdAt).toMatch(DATETIME_RE)
- expect(updatedAt).toMatch(DATETIME_RE)
- expect(updatedAt).toEqual(createdAt)
- let obj = await Test.update(client, id, { text: 'new' })
- expect(obj.createdAt).toEqual(createdAt)
- expect(obj.updatedAt).toMatch(DATETIME_RE)
- expect(obj.updatedAt).not.toEqual(createdAt)
- })
- test('check createBy/updateBy for anonymous', async () => {
- const client = await makeClient()
- let { id, createdBy, updatedBy } = await Test.create(client, {})
- expect(createdBy).toBe(null)
- expect(updatedBy).toBe(null)
- let obj = await Test.update(client, id, { text: 'new' })
- expect(obj.createdBy).toBe(null)
- expect(obj.updatedBy).toBe(null)
- })
- test('check createBy/updateBy for user1/user2', async () => {
- const client = await makeLoggedInClient()
- const admin = await makeLoggedInAdminClient()
- let { id, createdBy, updatedBy } = await Test.create(client, {})
- expect(createdBy).toEqual({ id: client.user.id })
- expect(updatedBy).toEqual({ id: client.user.id })
- let obj = await Test.update(admin, id, { text: 'new' })
- expect(obj.createdBy).toEqual({ id: client.user.id })
- expect(obj.updatedBy).toEqual({ id: admin.user.id })
- })
- test('try to set createBy', async () => {
- const client = await makeLoggedInClient()
- const admin = await makeLoggedInAdminClient()
- const { data, errors } = await Test.create(client, { createdBy: { connect: { id: admin.user.id } } }, { raw: true })
- expect(data).toEqual(undefined)
- expect(JSON.stringify(errors)).toMatch(/Field [\\"']+createdBy[\\"']+ is not defined by type [\\"']+TestCreateInput[\\"']+/i)
- })
-})
-
-describe('softDeleted()', () => {
- test('check deletedAt is auto generated and accept any string', async () => {
- const client = await makeClient()
- let obj = await TestSoftDeletedObj.create(client)
- obj = await TestSoftDeletedObj.update(client, obj.id, { deletedAt: 'true' })
- expect(obj.deletedAt).toMatch(DATETIME_RE)
- })
- test('check delete after delete', async () => {
- const client = await makeClient()
- let obj = await TestSoftDeletedObj.create(client)
- obj = await TestSoftDeletedObj.update(client, obj.id, { deletedAt: 'true' })
- const { errors } = await TestSoftDeletedObj.update(client, obj.id, { deletedAt: new Date().toISOString() }, { raw: true })
- expect(errors[0]).toMatchObject({
- 'message': 'Already deleted',
- 'name': 'GraphQLError',
- })
- })
- test('check update after delete', async () => {
- const client = await makeClient()
- let obj = await TestSoftDeletedObj.create(client)
- obj = await TestSoftDeletedObj.update(client, obj.id, { deletedAt: 'true' })
- const { errors } = await TestSoftDeletedObj.update(client, obj.id, { meta: { foo: 1 } }, { raw: true })
- expect(errors[0]).toMatchObject({
- 'message': 'Already deleted',
- 'name': 'GraphQLError',
- })
- })
- test('check create deleted obj', async () => {
- const client = await makeClient()
- const { errors } = await TestSoftDeletedObj.create(client, { deletedAt: 'true' }, { raw: true })
- expect(errors[0]).toMatchObject({
- 'message': 'Variable "$data" got invalid value { deletedAt: "true" }; Field "deletedAt" is not defined by type "TestSoftDeletedObjCreateInput".',
- 'name': 'GraphQLError',
- })
- })
- test('check disallow to hard delete', async () => {
- const client = await makeLoggedInAdminClient()
- let obj = await TestSoftDeletedObj.create(client)
- const { errors } = await TestSoftDeletedObj.delete(client, obj.id, { raw: true })
- expect(errors[0]).toMatchObject({
- 'message': 'You do not have access to this resource',
- 'name': 'AccessDeniedError',
- })
- })
- test('check filter by default deletedAt = null', async () => {
- const client = await makeLoggedInAdminClient()
- const rand = faker.random.number()
- let obj1 = await TestSoftDeletedObj.create(client, { meta: { rand } })
- let obj2 = await TestSoftDeletedObj.create(client, { meta: { rand } })
-
- await TestSoftDeletedObj.update(client, obj1.id, { deletedAt: 'true' })
-
- const objs = await TestSoftDeletedObj.getAll(client, { meta_in: [{ rand }] })
- expect(objs.map(x => x.id)).toEqual([obj2.id])
- })
- test('check filter by default newId = null', async () => {
- const client = await makeLoggedInAdminClient()
- const rand = faker.random.number()
- let obj1 = await TestSoftDeletedObj.create(client, { meta: { rand } })
- let obj2 = await TestSoftDeletedObj.create(client, { meta: { rand } })
-
- await TestSoftDeletedObj.update(client, obj1.id, { newId: obj2.id })
-
- let objs = await TestSoftDeletedObj.getAll(client, { meta_in: [{ rand }] })
- expect(objs.map(x => x.id)).toEqual([obj2.id])
- })
-})
-
-describe('TestAutoIncrementNumber field', () => {
- if (isMongo()) return console.error('SKIP() Mongo: Need to implement AutoIncrementIntegerMongooseFieldAdapter!')
-
- test('generate incremental number', async () => {
- const client = await makeLoggedInClient()
- const obj = await TestAutoIncrementNumber.create(client)
- expect(typeof obj.number).toBe('number')
- const obj2 = await TestAutoIncrementNumber.create(client)
- expect(obj2.number > obj.number).toBe(true)
- })
-
- test('set number by hands', async () => {
- const client = await makeLoggedInClient()
- const number = faker.random.number(1000, 10000000)
- const obj = await TestAutoIncrementNumber.create(client, { number })
- expect(obj.number).toBe(number)
- })
-
- test('set existing number', async () => {
- const client = await makeLoggedInClient()
- const obj = await TestAutoIncrementNumber.create(client)
- const { data, errors } = await TestAutoIncrementNumber.create(client, { number: obj.number }, { raw: true })
- expect(data).toStrictEqual({ 'obj': null })
- expect(errors[0]).toMatchObject({
- message: 'You attempted to perform an invalid mutation',
- name: 'ValidationFailureError',
- data: {
- messages: ['[unique:alreadyExists:number] Field number should be unique'],
- },
- path: ['obj'],
- })
- })
-})
diff --git a/apps/_demo/schema/User.js b/apps/_demo/schema/User.js
deleted file mode 100644
index ce61f010..00000000
--- a/apps/_demo/schema/User.js
+++ /dev/null
@@ -1,124 +0,0 @@
-const { Wysiwyg } = require('@keystonejs/fields-wysiwyg-tinymce')
-const { LocalFileAdapter } = require('@keystonejs/file-adapters')
-const { Text, Checkbox, File } = require('@keystonejs/fields')
-const { User: BaseUser, ForgotPasswordAction, ForgotPasswordService, RegisterNewUserService: BaseRegisterNewUserService } = require('@core/keystone/schemas/User')
-const conf = require('@core/config')
-const access = require('@core/keystone/access')
-const faker = require('faker')
-const { admin } = require('../utils/firebase.back.utils')
-
-const { Stars, Json, Options } = require('@core/keystone/fields')
-
-const AVATAR_FILE_ADAPTER = new LocalFileAdapter({
- src: `${conf.MEDIA_ROOT}/avatars`,
- path: `${conf.MEDIA_URL}/avatars`,
-})
-
-const User = BaseUser._override({
- fields: {
- avatar: { type: File, adapter: AVATAR_FILE_ADAPTER },
- rating: { type: Stars, starCount: 5 },
- settings: { type: Options, options: ['Feature1', 'Feature2'] },
- meta: { type: Json },
- aboutMyself: { type: Wysiwyg },
- phone: {
- factory: () => faker.phone.phoneNumberFormat(),
- type: Text,
- access: {
- read: true,
- create: access.userIsAdmin,
- update: access.userIsAdmin,
- },
- hooks: {
- resolveInput: async ({ resolvedData }) => {
- return resolvedData['phone'] && resolvedData['phone'].toLowerCase().replace(/[^+0-9]/g, '')
- },
- },
- // TODO(pahaz): think about mongodb!
- kmigratorOptions: { unique: true }, // Just for postgres (bug with mongo)
- },
- isPhoneVerified: {
- type: Checkbox,
- defaultValue: false,
- access: {
- read: true,
- create: access.userIsAdmin,
- update: access.userIsAdmin,
- },
- },
- importId: {
- factory: () => faker.random.uuid(),
- type: Text,
- access: {
- read: true,
- create: access.userIsAdmin,
- update: access.userIsAdmin,
- },
- // TODO(pahaz): think about mongodb!
- kmigratorOptions: { unique: true }, // Just for postgres (bug with mongo)
- },
- },
-})
-
-const RegisterNewUserService = BaseRegisterNewUserService._override({
- types: [
- {
- access: true,
- type: 'input RegisterNewUserInput { name: String!, email: String!, password: String!, firebaseIdToken: String }',
- },
- ],
-})
-
-async function checkUnique (context, model, models, field, value) {
- const { errors, data } = await context.executeGraphQL({
- context: context.createContext({ skipAccessControl: true }),
- query: `
- query find($where: ${model}WhereInput!) {
- objs: all${models}(where: $where) {
- id
- }
- }
- `,
- variables: { where: { [field]: value } },
- })
-
- if (errors) {
- const msg = `[error] Unable to check field ${field} uniques`
- console.error(msg, errors)
- throw new Error(msg)
- }
-
- if (data.objs.length !== 0) {
- throw new Error(`[unique:${field}:multipleFound] ${models} with this ${field} is already exists`)
- }
-}
-
-RegisterNewUserService.on('beforeRegisterNewUser', async ({ parent, args, context, info, extra }) => {
- const idToken = args.data.firebaseIdToken
- if (!idToken) return
-
- delete args.data.firebaseIdToken
- const { uid, phone_number } = await admin.auth().verifyIdToken(idToken)
- await checkUnique(context, 'User', 'Users', 'phone', phone_number)
- await checkUnique(context, 'User', 'Users', 'importId', uid)
- extra.extraUserData = {
- phone: phone_number,
- isPhoneVerified: true,
- importId: uid,
- }
-})
-
-ForgotPasswordService.on('afterStartPasswordRecovery', ({ parent, args, context, info, extra, result }) => {
- console.log('Fake send security email!', JSON.stringify(result))
-})
-
-ForgotPasswordService.on('afterChangePasswordWithToken', ({ parent, args, context, info, extra, result }) => {
- console.log('Fake send security email!', JSON.stringify(result))
-})
-
-module.exports = {
- User,
- ForgotPasswordAction,
- ForgotPasswordService,
- RegisterNewUserService,
-}
diff --git a/apps/_demo/schema/User.test.js b/apps/_demo/schema/User.test.js
deleted file mode 100644
index 5d87ed8f..00000000
--- a/apps/_demo/schema/User.test.js
+++ /dev/null
@@ -1,521 +0,0 @@
-/**
- * @jest-environment node
- */
-
-const conf = require('@core/config')
-const { setFakeClientMode } = require('@core/keystone/test.utils')
-if (conf.TESTS_FAKE_CLIENT_MODE) setFakeClientMode(require.resolve('../index'))
-
-const faker = require('faker')
-const { getRandomString, isMongo, DEFAULT_TEST_USER_IDENTITY, DEFAULT_TEST_USER_SECRET, gql } = require('@core/keystone/test.utils')
-const { makeClient, makeLoggedInClient, createUser, getSchemaObject, createSchemaObject, makeLoggedInAdminClient } = require('@core/keystone/test.utils')
-
-const { User, ForgotPasswordAction } = require('../schema/User')
-
-describe('MODEL', () => {
- const GET_USER_BY_ID_QUERY = gql`
- query getUserById($id: ID!) {
- user: User(where: {id: $id}) {
- id
- email
- name
- }
- }
- `
-
- test('user: convert email to lower case', async () => {
- const client = await makeLoggedInAdminClient()
- const email = 'XXX' + getRandomString() + '@example.com'
- const user = await createUser({ email })
-
- const { data } = await client.query(GET_USER_BY_ID_QUERY, { id: user.id })
- expect(data.user).toEqual({ email: email.toLowerCase(), id: user.id, name: user.name })
-
- const client2 = await makeLoggedInClient({ email: email.toLowerCase(), password: user.password })
- expect(client2.user.id).toEqual(user.id)
-
- // TODO(pahaz): fix in a future (it's no OK if you can't logged in by upper case email)
- const checkAuthByUpperCaseEmail = async () => {
- await makeLoggedInClient({ email, password: user.password })
- }
- await expect(checkAuthByUpperCaseEmail).rejects.toThrow(/passwordAuth:identity:notFound/)
- })
-
- test('createSchemaObject()', async () => {
- const { id } = await createSchemaObject(User)
- expect(id).toMatch(/^[A-Za-z0-9-]+$/g)
- })
-})
-
-describe('QUERY ALL/COUNT ACCESS', () => {
- const ALL_USERS_QUERY = gql`
- query {
- users: allUsers {
- id
- email
- name
- }
- }
- `
-
- const COUNT_OF_USERS_QUERY = gql`
- query {
- meta: _allUsersMeta {
- count
- }
- }
- `
-
- test('anonymous: get all users', async () => {
- const client = await makeClient()
- const { data, errors } = await client.query(ALL_USERS_QUERY)
- expect(data).toEqual({ users: null })
- expect(errors[0]).toMatchObject({
- 'data': { 'target': 'allUsers', 'type': 'query' },
- 'message': 'You do not have access to this resource',
- 'name': 'AccessDeniedError',
- 'path': ['users'],
- })
- })
-
- test('anonymous: get count of users', async () => {
- const client = await makeClient()
- const { data, errors } = await client.query(COUNT_OF_USERS_QUERY)
- expect(data).toEqual({ meta: { count: null } })
- expect(errors[0]).toMatchObject({
- 'data': { 'target': '_allUsersMeta', 'type': 'query' },
- 'message': 'You do not have access to this resource',
- 'name': 'AccessDeniedError',
- 'path': ['meta', 'count'],
- })
- })
-
- test('user: get all users', async () => {
- const user = await createUser()
- const client = await makeLoggedInClient(user)
- const { data } = await client.query(ALL_USERS_QUERY)
- expect(data.users).toEqual(
- expect.arrayContaining([
- expect.objectContaining({ id: user.id, name: user.name, email: user.email }),
- expect.objectContaining({ email: null }),
- ]),
- )
- })
-
- test('user: get count of users', async () => {
- const user = await createUser()
- const client = await makeLoggedInClient(user)
- const { data } = await client.query(COUNT_OF_USERS_QUERY)
- expect(data.meta.count).toBeGreaterThanOrEqual(2)
- })
-})
-
-describe('SIGNIN', () => {
- const SIGNIN_MUTATION = gql`
- mutation sigin($identity: String, $secret: String) {
- auth: authenticateUserWithPassword(email: $identity, password: $secret) {
- user: item {
- id
- }
- }
- }
- `
-
- const GET_MY_USERINFO = gql`
- query getUser {
- user: authenticatedUser {
- id
- }
- }
- `
-
- test('anonymous: try to sign in', async () => {
- const client = await makeClient()
- const { data, errors } = await client.mutate(SIGNIN_MUTATION, {
- 'identity': DEFAULT_TEST_USER_IDENTITY,
- 'secret': DEFAULT_TEST_USER_SECRET,
- })
- expect(errors).toEqual(undefined)
- expect(data.auth.user.id).toMatch(/[a-zA-Z0-9-_]+/)
- })
-
- test('anonymous: get user info', async () => {
- const client = await makeClient()
- const { data, errors } = await client.query(GET_MY_USERINFO)
- expect(errors).toEqual(undefined)
- expect(data).toEqual({ 'user': null })
- })
-
- test('get user info after sign in', async () => {
- const client = await makeLoggedInClient()
- const { data, errors } = await client.query(GET_MY_USERINFO)
- expect(errors).toEqual(undefined)
- expect(data.user).toEqual({ id: client.user.id })
- })
-
- test('anonymous: wrong password', async () => {
- const client = await makeClient()
- const { data, errors } = await client.mutate(SIGNIN_MUTATION, {
- 'identity': DEFAULT_TEST_USER_IDENTITY,
- 'secret': 'wrong password',
- })
- expect(data).toEqual({ 'auth': null })
- expect(JSON.stringify(errors)).toEqual(expect.stringMatching('passwordAuth:secret:mismatch'))
- })
-
- test('anonymous: wrong email', async () => {
- const client = await makeClient()
- const { data, errors } = await client.mutate(SIGNIN_MUTATION, {
- 'identity': 'some3571592131usermail@example.com',
- 'secret': 'wrong password',
- })
- expect(data).toEqual({ 'auth': null })
- expect(JSON.stringify(errors)).toEqual(expect.stringMatching('passwordAuth:identity:notFound'))
- })
-
- test('check auth by empty password', async () => {
- const user = await createUser({ password: '' })
- const checkAuthByEmptyPassword = async () => {
- await makeLoggedInClient({ email: user.email, password: '' })
- }
- await expect(checkAuthByEmptyPassword).rejects.toThrow(/passwordAuth:secret:notSet/)
- })
-})
-
-describe('REGISTER', () => {
- const REGISTER_NEW_USER_MUTATION = gql`
- mutation registerNewUser($data: RegisterNewUserInput!) {
- user: registerNewUser(data: $data) {
- id
- }
- }
- `
-
- test('register new user', async () => {
- const client = await makeClient()
- const name = faker.fake('{{name.suffix}} {{name.firstName}} {{name.lastName}}')
- const password = faker.internet.password()
- const email = faker.internet.exampleEmail()
- const { data, errors } = await client.mutate(REGISTER_NEW_USER_MUTATION, { data: { name, password, email } })
- expect(errors).toEqual(undefined)
- expect(data.user.id).toMatch(/^[0-9a-zA-Z-_]+$/)
- })
-
- test('register user with existed email', async () => {
- const user = await createUser()
- const client = await makeClient()
- const name = faker.fake('{{name.suffix}} {{name.firstName}} {{name.lastName}}')
- const password = faker.internet.password()
- const email = user.email
- const { errors } = await client.mutate(REGISTER_NEW_USER_MUTATION, { data: { name, password, email } })
- expect(JSON.stringify(errors)).toMatch(/register:email:multipleFound/)
- })
-})
-
-describe('FORGOT_RECOVERY_CHANGE_PASSWORD', () => {
- const ALL_FORGOT_PASSWORD_ACTIONS_QUERY = gql`
- query {
- objs: allForgotPasswordActions {
- id
- user {
- id
- }
- token
- }
- }
- `
-
- const START_PASSWORD_RECOVERY_MUTATION = gql`
- mutation startPasswordRecovery($email: String!){
- status: startPasswordRecovery(email: $email)
- }
- `
-
- const CHANGE_PASSWORD_WITH_TOKEN_MUTATION = gql`
- mutation changePasswordWithToken($token: String!, $password: String!) {
- status: changePasswordWithToken(token: $token, password: $password)
- }
- `
-
- const ALL_TOKENS_FOR_USER_QUERY = gql`
- query findTokenForUser($email: String!) {
- passwordTokens: allForgotPasswordActions(where: { user: { email: $email}}) {
- id
- token
- user {
- id
- }
- }
- }
- `
-
- test('anonymous: get all ForgotPasswordActions', async () => {
- const client = await makeClient()
- const { data, errors } = await client.query(ALL_FORGOT_PASSWORD_ACTIONS_QUERY)
- expect(errors[0]).toMatchObject({
- 'data': { 'target': 'allForgotPasswordActions', 'type': 'query' },
- 'message': 'You do not have access to this resource',
- 'name': 'AccessDeniedError',
- 'path': ['objs'],
- })
- expect(data).toEqual({ objs: null })
- })
-
- test('user: get all ForgotPasswordActions', async () => {
- const user = await createUser()
- const client = await makeLoggedInClient(user)
- const { data, errors } = await client.query(ALL_FORGOT_PASSWORD_ACTIONS_QUERY)
- expect(errors[0]).toMatchObject({
- 'data': { 'target': 'allForgotPasswordActions', 'type': 'query' },
- 'message': 'You do not have access to this resource',
- 'name': 'AccessDeniedError',
- 'path': ['objs'],
- })
- expect(data).toEqual({ objs: null })
- })
-
- test('reset forgotten password', async () => {
- const user = await createUser()
- const client = await makeClient()
- const adm = await makeLoggedInAdminClient()
- const res1 = await client.mutate(START_PASSWORD_RECOVERY_MUTATION, { email: user.email })
- expect(res1.errors).toEqual(undefined)
- expect(res1.data).toEqual({ status: 'ok' })
-
- // get created token
- const { data: { passwordTokens } } = await adm.query(ALL_TOKENS_FOR_USER_QUERY, { email: user.email })
- expect(passwordTokens).toHaveLength(1)
- const token = passwordTokens[0].token
- expect(token).toMatch(/^[a-zA-Z0-9-]{7,40}$/g)
-
- // change password
- const password = `${user.password}:${user.password}:new`
- const res2 = await client.mutate(CHANGE_PASSWORD_WITH_TOKEN_MUTATION, { token, password })
- expect(res2.errors).toEqual(undefined)
- expect(res2.data).toEqual({ status: 'ok' })
-
- // check logging by new password
- const newClient = await makeLoggedInClient({ email: user.email, password })
- expect(newClient.user.id).toEqual(user.id)
- })
-
- test('start recovery for unknown email', async () => {
- const client = await makeClient()
- const res1 = await client.mutate(START_PASSWORD_RECOVERY_MUTATION, { email: 'random231314@emample.com' })
- expect(JSON.stringify(res1.errors)).toEqual(expect.stringMatching('unknown-user'))
- })
-
- test('change password to empty', async () => {
- const { id } = await createSchemaObject(ForgotPasswordAction)
- const obj = await getSchemaObject(ForgotPasswordAction, ['token'], { id })
- const client = await makeClient()
- const res1 = await client.mutate(CHANGE_PASSWORD_WITH_TOKEN_MUTATION, {
- token: obj.token, password: '',
- })
- expect(res1.data).toEqual({ status: 'ok' })
- })
-})
-
-describe('MODEL User.settings field', () => {
- const USER_FIELDS = '{ id settings { Feature1 Feature2 } }'
- const GET_USER_BY_ID_QUERY = gql`
- query getUserById($id: ID!) {
- user: User(where: {id: $id}) ${USER_FIELDS}
- }
- `
-
- const UPDATE_USER_BY_ID_MUTATION = gql`
- mutation updateUserById($id:ID!, $data: UserUpdateInput!) {
- user: updateUser(id: $id, data: $data) ${USER_FIELDS}
- }
- `
-
- const ALL_USERS_QUERY = gql`
- query getAll($data: UserWhereInput!) {
- users: allUsers(where: $data) ${USER_FIELDS}
- }
- `
-
- test('user: set settings', async () => {
- const client = await makeLoggedInAdminClient()
- const user = await createUser({ settings: { 'Feature1': true } })
- console.log('user.id', user.id)
-
- const { data, errors } = await client.query(GET_USER_BY_ID_QUERY, { id: user.id })
- expect(errors).toEqual(undefined)
- expect(data.user).toEqual({
- id: user.id,
- settings: {
- 'Feature1': true,
- 'Feature2': null,
- },
- })
- })
-
- test('user: set unknown settings', async () => {
- async function run () {
- return await createUser({ settings: { 'Feature22': true, 'Feature1': true } })
- }
-
- await expect(run).rejects.toThrow(/Variable "\$data" got invalid value/)
- })
-
- test('user: set settings = null', async () => {
- const client = await makeLoggedInAdminClient()
- const user = await createUser({ settings: null })
- console.log('user.id', user.id)
-
- const { data, errors } = await client.query(GET_USER_BY_ID_QUERY, { id: user.id })
- expect(errors).toEqual(undefined)
- expect(data.user).toEqual({
- id: user.id,
- settings: {
- 'Feature1': null,
- 'Feature2': null,
- },
- })
- })
-
- test('user: set settings value = null', async () => {
- const client = await makeLoggedInAdminClient()
- const user = await createUser({ settings: { 'Feature1': null } })
- console.log('user.id', user.id)
-
- const { data, errors } = await client.query(GET_USER_BY_ID_QUERY, { id: user.id })
- expect(errors).toEqual(undefined)
- expect(data.user).toEqual({
- id: user.id,
- settings: {
- 'Feature1': null,
- 'Feature2': null,
- },
- })
- })
-
- test('user: set settings = undefined', async () => {
- const client = await makeLoggedInAdminClient()
- const user = await createUser({ settings: undefined })
- console.log('user.id', user.id)
-
- const { data, errors } = await client.query(GET_USER_BY_ID_QUERY, { id: user.id })
- expect(errors).toEqual(undefined)
- expect(data.user).toEqual({
- id: user.id,
- settings: {
- 'Feature1': null,
- 'Feature2': null,
- },
- })
- })
-
- test('user: set settings = {}', async () => {
- const client = await makeLoggedInAdminClient()
- const user = await createUser({ settings: {} })
- console.log('user.id', user.id)
-
- const { data, errors } = await client.query(GET_USER_BY_ID_QUERY, { id: user.id })
- expect(errors).toEqual(undefined)
- expect(data.user).toEqual({
- id: user.id,
- settings: {
- 'Feature1': null,
- 'Feature2': null,
- },
- })
- })
-
- test('user: merge settings', async () => {
- const client = await makeLoggedInAdminClient()
- const user = await createUser({ settings: { 'Feature1': false } })
- console.log('user.id', user.id)
-
- const { data, errors } = await client.mutate(UPDATE_USER_BY_ID_MUTATION, {
- id: user.id,
- data: { settings: { 'Feature2': true } },
- })
- expect(errors).toEqual(undefined)
- expect(data.user).toEqual({
- id: user.id,
- settings: {
- 'Feature1': false,
- 'Feature2': true,
- },
- })
- })
-
- test('user: filter settings by EQ', async () => {
- if (isMongo()) return console.error('SKIP() Mongo: need a custom query parser!')
-
- const client = await makeLoggedInAdminClient()
- const user1 = await createUser({ settings: { 'Feature1': true } })
- const user2 = await createUser({ settings: { 'Feature1': true } })
- const user3 = await createUser({ settings: { 'Feature1': false } })
- {
- const { data, errors } = await client.query(ALL_USERS_QUERY, { data: { settings: { 'Feature1': true } } })
- expect(errors).toEqual(undefined)
- const ids = data.users.map(x => x.id)
- expect(ids).toContain(user1.id)
- expect(ids).toContain(user2.id)
- expect(ids).not.toContain(user3.id)
- }
- {
- const { data, errors } = await client.query(ALL_USERS_QUERY, { data: { settings: { 'Feature1': false } } })
- expect(errors).toEqual(undefined)
- const ids = data.users.map(x => x.id)
- expect(ids).not.toContain(user1.id)
- expect(ids).not.toContain(user2.id)
- expect(ids).toContain(user3.id)
- }
- })
-
- test('user: filter settings by NULL', async () => {
- const client = await makeLoggedInAdminClient()
- const user1 = await createUser({ settings: null })
- const user2 = await createUser({ settings: undefined })
- const user3 = await createUser({ settings: {} })
- const user4 = await createUser({ settings: { 'Feature1': null } })
- const user5 = await createUser({ settings: { 'Feature1': undefined } })
- const user6 = await createUser({ settings: { 'Feature1': false } })
- const user7 = await createUser({ settings: { 'Feature1': true } })
- {
- const { data, errors } = await client.query(ALL_USERS_QUERY, { data: { settings: null } })
- expect(errors).toEqual(undefined)
- const ids = data.users.map(x => x.id)
- expect(ids).toContain(user1.id)
- expect(ids).toContain(user2.id)
- expect(ids).toContain(user3.id)
- expect(ids).toContain(user4.id)
- expect(ids).toContain(user5.id)
- expect(ids).not.toContain(user6.id)
- expect(ids).not.toContain(user7.id)
- }
- })
-
- test('user: filter settings by IN', async () => {
- const client = await makeLoggedInAdminClient()
- const user1 = await createUser({ settings: null })
- const user2 = await createUser({ settings: undefined })
- const user3 = await createUser({ settings: {} })
- const user4 = await createUser({ settings: { 'Feature1': null } })
- const user5 = await createUser({ settings: { 'Feature1': undefined } })
- const user6 = await createUser({ settings: { 'Feature1': false } })
- const user7 = await createUser({ settings: { 'Feature1': true } })
- const user8 = await createUser({ settings: { 'Feature1': true, 'Feature2': true } })
- const user9 = await createUser({ settings: { 'Feature1': true, 'Feature2': false } })
- {
- const { data, errors } = await client.query(ALL_USERS_QUERY, { data: { settings_in: [null, { 'Feature1': true }] } })
- expect(errors).toEqual(undefined)
- const ids = data.users.map(x => x.id)
- expect(ids).toContain(user1.id)
- expect(ids).toContain(user2.id)
- expect(ids).toContain(user3.id)
- expect(ids).toContain(user4.id)
- expect(ids).toContain(user5.id)
- expect(ids).not.toContain(user6.id)
- expect(ids).toContain(user7.id)
- expect(ids).not.toContain(user8.id)
- expect(ids).not.toContain(user9.id)
- }
- })
-})
-
diff --git a/apps/_demo/utils/firebase.back.utils.js b/apps/_demo/utils/firebase.back.utils.js
deleted file mode 100644
index 276ad272..00000000
--- a/apps/_demo/utils/firebase.back.utils.js
+++ /dev/null
@@ -1,16 +0,0 @@
-const admin = require('firebase-admin')
-const conf = require('@core/config')
-
-const FIREBASE_ADMIN_CONFIG = conf['FIREBASE_ADMIN_CONFIG'] && JSON.parse(conf['FIREBASE_ADMIN_CONFIG'])
-const FIREBASE_CONFIG = conf['FIREBASE_CONFIG'] && JSON.parse(conf['FIREBASE_CONFIG'])
-
-if (FIREBASE_ADMIN_CONFIG) {
- admin.initializeApp({
- credential: admin.credential.cert(FIREBASE_ADMIN_CONFIG),
- databaseURL: FIREBASE_CONFIG.databaseURL,
- })
-}
-
-module.exports = {
- admin,
-}
diff --git a/apps/_demo/utils/firebase.front.utils.js b/apps/_demo/utils/firebase.front.utils.js
deleted file mode 100644
index adc2c702..00000000
--- a/apps/_demo/utils/firebase.front.utils.js
+++ /dev/null
@@ -1,25 +0,0 @@
-import * as firebase from 'firebase'
-import getConfig from 'next/config'
-
-const {
- publicRuntimeConfig: { firebaseConfig },
-} = getConfig()
-
-const FIREBASE_CONFIG = firebaseConfig || {}
-try {
- if (FIREBASE_CONFIG.apiKey) {
- firebase.initializeApp(FIREBASE_CONFIG)
- // firebase.analytics()
- }
-} catch (err) {
- // ignore app already initialized error on snack
- console.error(err)
-}
-
-const isFirebaseConfigValid = !!FIREBASE_CONFIG.apiKey
-
-export default firebase
-export {
- isFirebaseConfigValid,
- FIREBASE_CONFIG,
-}
diff --git a/apps/_ex01back/index.js b/apps/_ex01back/index.js
deleted file mode 100644
index a8559700..00000000
--- a/apps/_ex01back/index.js
+++ /dev/null
@@ -1,53 +0,0 @@
-const { Keystone } = require('@keystonejs/keystone')
-const { GraphQLApp } = require('@keystonejs/app-graphql')
-const { AdminUIApp } = require('@keystonejs/app-admin-ui')
-const { PasswordAuthStrategy } = require('@keystonejs/auth-password')
-const { createItems } = require('@keystonejs/server-side-graphql-client')
-
-const conf = require('@core/config')
-const { registerSchemas } = require('@core/keystone/schema')
-const { prepareDefaultKeystoneConfig } = require('@core/keystone/setup.utils')
-
-const keystone = new Keystone({
- ...prepareDefaultKeystoneConfig(conf),
- onConnect: async () => {
- if (conf.NODE_ENV !== 'development') return // Just for dev purposes!
-
- // This function can be called before tables are created! (we just ignore this)
- try {
- const users = await keystone.lists.User.adapter.findAll()
- if (!users.length) {
- const initialData = require('./initialData')
- for (let { listKey, items } of initialData) {
- await createItems({
- keystone,
- listKey,
- items,
- })
- }
- }
- } catch (e) {
- console.warn('Keystone.onConnect() Error:', e)
- }
- },
-})
-
-registerSchemas(keystone, [
- require('./schema/User'),
-])
-
-const authStrategy = keystone.createAuthStrategy({
- type: PasswordAuthStrategy,
- list: 'User',
-})
-
-module.exports = {
- keystone,
- apps: [
- new GraphQLApp(),
- new AdminUIApp({
- authStrategy,
- enableDefaultRoute: true,
- }),
- ],
-}
diff --git a/apps/_ex01back/initialData.js b/apps/_ex01back/initialData.js
deleted file mode 100644
index 5b777d87..00000000
--- a/apps/_ex01back/initialData.js
+++ /dev/null
@@ -1,29 +0,0 @@
-module.exports = [
- {
- listKey: 'User',
- items: [
- {
- data: {
- name: 'Admin',
- email: 'admin@example.com',
- isEmailVerified: false,
- isAdmin: true,
- isActive: true,
- dob: '1990-01-02',
- password: '3a74b3f07978',
- },
- },
- {
- data: {
- name: 'JustUser',
- email: 'user@example.com',
- isEmailVerified: false,
- isAdmin: false,
- isActive: true,
- dob: '1995-06-09',
- password: '1a92b3a07c78',
- },
- },
- ],
- },
-]
diff --git a/apps/_ex01back/migrations/20210203205359-0001_initial.js b/apps/_ex01back/migrations/20210203205359-0001_initial.js
deleted file mode 100644
index 4ce7451f..00000000
--- a/apps/_ex01back/migrations/20210203205359-0001_initial.js
+++ /dev/null
@@ -1,31 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0001_initial:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjEtMDItMDMgMTc6NTQKCmltcG9ydCBkamFuZ28uY29udHJpYi5wb3N0Z3Jlcy5maWVsZHMuanNvbmIKZnJvbSBkamFuZ28uZGIgaW1wb3J0IG1pZ3JhdGlvbnMsIG1vZGVscwppbXBvcnQgZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbgoKCmNsYXNzIE1pZ3JhdGlvbihtaWdyYXRpb25zLk1pZ3JhdGlvbik6CgogICAgaW5pdGlhbCA9IFRydWUKCiAgICBkZXBlbmRlbmNpZXMgPSBbCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkNyZWF0ZU1vZGVsKAogICAgICAgICAgICBuYW1lPSd1c2VyJywKICAgICAgICAgICAgZmllbGRzPVsKICAgICAgICAgICAgICAgICgnaWQnLCBtb2RlbHMuQXV0b0ZpZWxkKHByaW1hcnlfa2V5PVRydWUsIHNlcmlhbGl6ZT1GYWxzZSkpLAogICAgICAgICAgICAgICAgKCdlbWFpbCcsIG1vZGVscy5UZXh0RmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlL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EF0X29mZnNldCcsIG1vZGVscy5UZXh0RmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSksCiAgICAgICAgICAgICAgICAoJ2NyZWF0ZWRCeScsIG1vZGVscy5Gb3JlaWduS2V5KGJsYW5rPVRydWUsIGRiX2NvbHVtbj0nY3JlYXRlZEJ5JywgbnVsbD1UcnVlLCBvbl9kZWxldGU9ZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbi5ET19OT1RISU5HLCByZWxhdGVkX25hbWU9JysnLCB0bz0nX2RqYW5nb19zY2hlbWEudXNlcicpKSwKICAgICAgICAgICAgICAgICgndXBkYXRlZEJ5JywgbW9kZWxzLkZvcmVpZ25LZXkoYmxhbms9VHJ1ZSwgZGJfY29sdW1uPSd1cGRhdGVkQnknLCBudWxsPVRydWUsIG9uX2RlbGV0ZT1kamFuZ28uZGIubW9kZWxzLmRlbGV0aW9uLkRPX05PVEhJTkcsIHJlbGF0ZWRfbmFtZT0nKycsIHRvPSdfZGphbmdvX3NjaGVtYS51c2VyJykpLAogICAgICAgICAgICBdLAogICAgICAgICAgICBvcHRpb25zPXsKICAgICAgICAgICAgICAgICdkYl90YWJsZSc6ICdVc2VyJywKICAgICAgICAgICAgfSwKICAgICAgICApLAogICAgXQo=
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Create model user
---
-CREATE TABLE "User" ("id" serial NOT NULL PRIMARY KEY, "email" text NULL UNIQUE, "isEmailVerified" boolean NOT NULL, "isAdmin" boolean NOT NULL, "name" text NULL, "isActive" boolean NOT NULL, "password" varchar(60) NULL, "avatar" jsonb NULL, "dob" date NULL, "aboutMyself" text NULL, "updatedAt_utc" timestamp with time zone NULL, "updatedAt_offset" text NULL, "createdAt_utc" timestamp with time zone NULL, "createdAt_offset" text NULL, "createdBy" integer NULL, "updatedBy" integer NULL);
-ALTER TABLE "User" ADD CONSTRAINT "User_createdBy_7f87595a_fk_User_id" FOREIGN KEY ("createdBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "User" ADD CONSTRAINT "User_updatedBy_998aac8b_fk_User_id" FOREIGN KEY ("updatedBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-CREATE INDEX "User_email_667201b5_like" ON "User" ("email" text_pattern_ops);
-CREATE INDEX "User_createdBy_7f87595a" ON "User" ("createdBy");
-CREATE INDEX "User_updatedBy_998aac8b" ON "User" ("updatedBy");
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Create model user
---
-DROP TABLE "User" CASCADE;
-COMMIT;
-
- `)
-}
diff --git a/apps/_ex01back/package.json b/apps/_ex01back/package.json
deleted file mode 100644
index 08d4ed11..00000000
--- a/apps/_ex01back/package.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "name": "@app/ex01back",
- "version": "2.0.0",
- "private": true,
- "scripts": {
- "test": "jest --testTimeout=10000",
- "dev": "nodemon --exec keystone dev",
- "debug": "node inspect node_modules/.bin/keystone dev",
- "build": "keystone build",
- "start": "keystone start",
- "makemigrations": "./../../bin/kmigrator.py makemigrations",
- "migrate": "./../../bin/kmigrator.py migrate"
- },
- "dependencies": {
- "@keystonejs/adapter-knex": "^12.0.2",
- "@keystonejs/adapter-mongoose": "^10.0.1",
- "@keystonejs/adapter-prisma": "^1.1.2",
- "@keystonejs/app-admin-ui": "^7.3.9",
- "@keystonejs/app-graphql": "^6.1.0",
- "@keystonejs/app-next": "^5.2.1",
- "@keystonejs/app-static": "^5.1.2",
- "@keystonejs/auth-password": "^5.1.17",
- "@keystonejs/fields-wysiwyg-tinymce": "^5.3.13",
- "@keystonejs/file-adapters": "^7.0.3",
- "@keystonejs/keystone": "^17.1.1",
- "@keystonejs/server-side-graphql-client": "^1.1.2",
- "@keystonejs/utils": "^6.0.1",
- "@keystonejs/fields-color": "^1.0.7",
- "@keystonejs/fields-content": "^9.0.2",
- "@keystonejs/fields-location-google": "^3.0.2",
- "@keystonejs/list-plugins": "^7.1.4",
- "cross-env": "^7.0.0",
- "nodemon": "^2.0.7"
- },
- "repository": "https://github.com/pahaz/hackathon-boilerplate-starter-kit/tree/master/apps/_ex01back"
-}
diff --git a/apps/_ex01back/schema/User.js b/apps/_ex01back/schema/User.js
deleted file mode 100644
index d2ee68ce..00000000
--- a/apps/_ex01back/schema/User.js
+++ /dev/null
@@ -1,12 +0,0 @@
-const { Wysiwyg } = require('@keystonejs/fields-wysiwyg-tinymce')
-const { User: BaseUser } = require('@core/keystone/schemas/User')
-
-const User = BaseUser._override({
- fields: {
- aboutMyself: { type: Wysiwyg },
- },
-})
-
-module.exports = {
- User,
-}
diff --git a/apps/_ex01front/package.json b/apps/_ex01front/package.json
deleted file mode 100644
index a917f3f8..00000000
--- a/apps/_ex01front/package.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "name": "@app/ex01front",
- "version": "1.0.0",
- "scripts": {
- "dev": "next",
- "build": "next build",
- "start": "next start",
- "test": "next build"
- },
- "dependencies": {
- "next": "^9.5.2"
- },
- "repository": "https://github.com/pahaz/hackathon-boilerplate-starter-kit/tree/master/apps/_ex01front"
-}
diff --git a/apps/_ex01front/pages/index.jsx b/apps/_ex01front/pages/index.jsx
deleted file mode 100644
index 551f7d32..00000000
--- a/apps/_ex01front/pages/index.jsx
+++ /dev/null
@@ -1,5 +0,0 @@
-function HomePage () {
- return Welcome to Next.js!
-}
-
-export default HomePage
diff --git a/apps/_ex01mobile/App.js b/apps/_ex01mobile/App.js
deleted file mode 100644
index 88e86db5..00000000
--- a/apps/_ex01mobile/App.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import 'react-native-gesture-handler'
-import { StatusBar } from 'expo-status-bar'
-import React from 'react'
-import { IconRegistry } from '@ui-kitten/components'
-import { EvaIconsPack } from '@ui-kitten/eva-icons'
-
-import { AppNavigator } from './AppNavigator'
-import { ThemeState } from './context/theme'
-
-export default function App () {
- return (<>
-
-
-
-
-
- >)
-}
diff --git a/apps/_ex01mobile/AppNavigator.js b/apps/_ex01mobile/AppNavigator.js
deleted file mode 100644
index 9ac4347a..00000000
--- a/apps/_ex01mobile/AppNavigator.js
+++ /dev/null
@@ -1,21 +0,0 @@
-import React from 'react'
-import { NavigationContainer } from '@react-navigation/native'
-import { createStackNavigator } from '@react-navigation/stack'
-
-import { IndexScreen } from './screens/index.screen'
-import { DetailsScreen } from './screens/details.screen'
-
-const { Navigator, Screen } = createStackNavigator()
-
-const HomeNavigator = () => (
-
-
-
-
-)
-
-export const AppNavigator = () => (
-
-
-
-)
diff --git a/apps/_ex01mobile/app.json b/apps/_ex01mobile/app.json
deleted file mode 100644
index a296d3a5..00000000
--- a/apps/_ex01mobile/app.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "expo": {
- "name": "_mobile01",
- "slug": "_mobile01",
- "version": "1.0.0",
- "orientation": "portrait",
- "icon": "./assets/icon.png",
- "splash": {
- "image": "./assets/splash.png",
- "resizeMode": "contain",
- "backgroundColor": "#ffffff"
- },
- "updates": {
- "fallbackToCacheTimeout": 0
- },
- "assetBundlePatterns": [
- "**/*"
- ],
- "ios": {
- "supportsTablet": true
- },
- "web": {
- "favicon": "./assets/favicon.png"
- }
- }
-}
diff --git a/apps/_ex01mobile/assets/favicon.png b/apps/_ex01mobile/assets/favicon.png
deleted file mode 100644
index e75f697b..00000000
Binary files a/apps/_ex01mobile/assets/favicon.png and /dev/null differ
diff --git a/apps/_ex01mobile/assets/icon.png b/apps/_ex01mobile/assets/icon.png
deleted file mode 100644
index 6eaf3029..00000000
Binary files a/apps/_ex01mobile/assets/icon.png and /dev/null differ
diff --git a/apps/_ex01mobile/assets/splash.png b/apps/_ex01mobile/assets/splash.png
deleted file mode 100644
index cc94f379..00000000
Binary files a/apps/_ex01mobile/assets/splash.png and /dev/null differ
diff --git a/apps/_ex01mobile/babel.config.js b/apps/_ex01mobile/babel.config.js
deleted file mode 100644
index d265563a..00000000
--- a/apps/_ex01mobile/babel.config.js
+++ /dev/null
@@ -1,6 +0,0 @@
-module.exports = function (api) {
- api.cache(true)
- return {
- presets: ['babel-preset-expo'],
- }
-}
diff --git a/apps/_ex01mobile/context/theme.js b/apps/_ex01mobile/context/theme.js
deleted file mode 100644
index 812af5ad..00000000
--- a/apps/_ex01mobile/context/theme.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import React, { createContext, useState } from 'react'
-import { ApplicationProvider } from '@ui-kitten/components'
-import * as eva from '@eva-design/eva'
-
-export const ThemeContext = createContext({
- theme: 'light',
- toggleTheme: () => {},
-})
-
-export const ThemeState = ({ children }) => {
- const [theme, setTheme] = useState('light')
- const toggleTheme = () => {
- const nextTheme = theme === 'light' ? 'dark' : 'light'
- setTheme(nextTheme)
- }
-
- return
-
- {children}
-
-
-}
diff --git a/apps/_ex01mobile/metro.config.js b/apps/_ex01mobile/metro.config.js
deleted file mode 100644
index 77a75227..00000000
--- a/apps/_ex01mobile/metro.config.js
+++ /dev/null
@@ -1,3 +0,0 @@
-const { createMetroConfiguration } = require('expo-yarn-workspaces')
-
-module.exports = createMetroConfiguration(__dirname)
diff --git a/apps/_ex01mobile/package.json b/apps/_ex01mobile/package.json
deleted file mode 100644
index f14000dd..00000000
--- a/apps/_ex01mobile/package.json
+++ /dev/null
@@ -1,42 +0,0 @@
-{
- "name": "@app/ex01mobile",
- "version": "1.0.0",
- "main": "__generated__/AppEntry.js",
- "scripts": {
- "dev": "expo start",
- "start": "expo start",
- "android": "expo start --android",
- "ios": "expo start --ios",
- "web": "expo start --web",
- "eject": "expo eject",
- "postinstall": "expo-yarn-workspaces postinstall"
- },
- "dependencies": {
- "@eva-design/eva": "^2.0.0",
- "@expo/vector-icons": "^10.2.0",
- "@react-native-community/hooks": "^2.6.0",
- "@react-native-community/masked-view": "^0.1.10",
- "@react-navigation/native": "^5.7.3",
- "@react-navigation/stack": "^5.9.0",
- "@ui-kitten/components": "^5.0.0",
- "@ui-kitten/eva-icons": "^5.0.0",
- "expo": "^38.0.8",
- "expo-font": "^8.2.2",
- "expo-status-bar": "^1.0.2",
- "react": "^16.13.1",
- "react-dom": "^16.13.1",
- "react-native": "https://github.com/expo/react-native/archive/sdk-38.0.2.tar.gz",
- "react-native-gesture-handler": "^1.7.0",
- "react-native-reanimated": "^1.13.0",
- "react-native-safe-area-context": "^3.1.7",
- "react-native-screens": "^2.10.1",
- "react-native-svg": "^12.1.0",
- "react-native-web": "^0.13.9"
- },
- "devDependencies": {
- "@babel/core": "^7.10.3",
- "babel-preset-expo": "~8.1.0",
- "expo-yarn-workspaces": "^1.2.1"
- },
- "repository": "https://github.com/pahaz/hackathon-boilerplate-starter-kit/tree/master/apps/_ex01mobile"
-}
diff --git a/apps/_ex01mobile/screens/details.screen.js b/apps/_ex01mobile/screens/details.screen.js
deleted file mode 100644
index 7c8885fe..00000000
--- a/apps/_ex01mobile/screens/details.screen.js
+++ /dev/null
@@ -1,38 +0,0 @@
-import React from 'react'
-import { SafeAreaView, StyleSheet } from 'react-native'
-import { Divider, Icon, Layout, Text, TopNavigation, TopNavigationAction } from '@ui-kitten/components'
-
-const BackIcon = (props) => (
-
-)
-
-export const DetailsScreen = (props) => {
- const { navigation } = props
-
- const navigateBack = () => {
- navigation.goBack()
- }
-
- const BackAction = () => (
-
- )
-
- return (
-
-
-
-
- DETAILS
-
-
- )
-}
-
-const styles = StyleSheet.create({
- container: {
- flex: 1,
- backgroundColor: '#fff',
- alignItems: 'center',
- justifyContent: 'center',
- },
-})
diff --git a/apps/_ex01mobile/screens/index.screen.js b/apps/_ex01mobile/screens/index.screen.js
deleted file mode 100644
index 864f9aec..00000000
--- a/apps/_ex01mobile/screens/index.screen.js
+++ /dev/null
@@ -1,44 +0,0 @@
-import React, { useContext } from 'react'
-import { SafeAreaView, StyleSheet } from 'react-native'
-import { Button, Divider, Icon, Layout, TopNavigation } from '@ui-kitten/components'
-import { Entypo } from '@expo/vector-icons'
-
-import { ThemeContext } from '../context/theme'
-
-export const IndexScreen = ({ navigation }) => {
- const themeContext = useContext(ThemeContext)
-
- const navigateDetails = () => {
- navigation.navigate('Details')
- }
-
- return (
-
-
-
-
-
-
-
-
-
-
- )
-}
-
-const styles = StyleSheet.create({
- container: {
- flex: 1,
- backgroundColor: '#fff',
- alignItems: 'center',
- justifyContent: 'center',
- },
- icon: {
- width: 32,
- height: 32,
- },
-})
diff --git a/apps/_ex02back/index.js b/apps/_ex02back/index.js
deleted file mode 100644
index bcc7dfee..00000000
--- a/apps/_ex02back/index.js
+++ /dev/null
@@ -1,61 +0,0 @@
-const { Keystone } = require('@keystonejs/keystone')
-const { PasswordAuthStrategy } = require('@keystonejs/auth-password')
-const { GraphQLApp } = require('@keystonejs/app-graphql')
-const { AdminUIApp } = require('@keystonejs/app-admin-ui')
-const { StaticApp } = require('@keystonejs/app-static')
-const { createItems } = require('@keystonejs/server-side-graphql-client')
-
-const conf = require('@core/config')
-const access = require('@core/keystone/access')
-const { registerSchemas } = require('@core/keystone/schema')
-const { prepareDefaultKeystoneConfig } = require('@core/keystone/setup.utils')
-
-const keystone = new Keystone({
- ...prepareDefaultKeystoneConfig(conf),
- onConnect: async () => {
- // Initialise some data
- if (conf.NODE_ENV !== 'development') return // Just for dev env purposes!
- // This function can be called before tables are created! (we just ignore this)
- try {
- const users = await keystone.lists.User.adapter.findAll()
- if (!users.length) {
- const initialData = require('./initialData')
- for (let { listKey, items } of initialData) {
- console.log(`🗿 createItems(${listKey}) -> ${items.length}`)
- await createItems({
- keystone,
- listKey,
- items,
- })
- }
- }
- } catch (e) {
- console.warn('onConnectError:', e)
- }
- },
-})
-
-registerSchemas(keystone, [
- require('./schema/User'),
- require('./schema/Organization'),
-])
-
-const authStrategy = keystone.createAuthStrategy({
- type: PasswordAuthStrategy,
- list: 'User',
-})
-
-module.exports = {
- keystone,
- apps: [
- new GraphQLApp({
- apollo: { debug: conf.NODE_ENV === 'development' || conf.NODE_ENV === 'test' },
- }),
- new StaticApp({ path: conf.MEDIA_URL, src: conf.MEDIA_ROOT }),
- new AdminUIApp({
- adminPath: '/admin',
- isAccessAllowed: access.userIsAdmin,
- authStrategy,
- }),
- ],
-}
diff --git a/apps/_ex02back/initialData.js b/apps/_ex02back/initialData.js
deleted file mode 100644
index 5b777d87..00000000
--- a/apps/_ex02back/initialData.js
+++ /dev/null
@@ -1,29 +0,0 @@
-module.exports = [
- {
- listKey: 'User',
- items: [
- {
- data: {
- name: 'Admin',
- email: 'admin@example.com',
- isEmailVerified: false,
- isAdmin: true,
- isActive: true,
- dob: '1990-01-02',
- password: '3a74b3f07978',
- },
- },
- {
- data: {
- name: 'JustUser',
- email: 'user@example.com',
- isEmailVerified: false,
- isAdmin: false,
- isActive: true,
- dob: '1995-06-09',
- password: '1a92b3a07c78',
- },
- },
- ],
- },
-]
diff --git a/apps/_ex02back/migrations/20210203214827-0001_initial.js b/apps/_ex02back/migrations/20210203214827-0001_initial.js
deleted file mode 100644
index 9d3708db..00000000
--- a/apps/_ex02back/migrations/20210203214827-0001_initial.js
+++ /dev/null
@@ -1,73 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0001_initial:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjEtMDItMDMgMTg6NDgKCmltcG9ydCBkamFuZ28uY29udHJpYi5wb3N0Z3Jlcy5maWVsZHMuanNvbmIKZnJvbSBkamFuZ28uZGIgaW1wb3J0IG1pZ3JhdGlvbnMsIG1vZGVscwppbXBvcnQgZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbgoKCmNsYXNzIE1pZ3JhdGlvbihtaWdyYXRpb25zLk1pZ3JhdGlvbik6CgogICAgaW5pdGlhbCA9IFRydWUKCiAgICBkZXBlbmRlbmNpZXMgPSBbCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkNyZWF0ZU1vZGVsKAogICAgICAgICAgICBuYW1lPSdvcmdhbml6YXRpb24nLAogICAgICAgICAgICBmaWVsZHM9WwogICAgICAgICAgICAgICAgKCdpZCcsIG1vZGVscy5BdXRvR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5Cb29sZWFuRmllbGQoKSksCiAgICAgICAgICAgICAgICAoJ25hbWUnLCBtb2RlbHMuVGV4dEZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCdpc0FjdGl2ZScsIG1vZGVscy5Cb29sZWFuRmllbGQoKSksCiAgICAgICAgICAgICAgICAoJ3Bhc3N3b3JkJywgbW9kZWxzLkNoYXJGaWVsZChibGFuaz1UcnVlLCBtYXhfbGVuZ3RoPTYwLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgnYXZhdGFyJywgZGphbmdvLmNvbnRyaWIucG9zdGdyZXMuZmllbGRzLmpzb25iLkpTT05GaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgnZG9iJywgbW9kZWxzLkRhdGVGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgnbWV0YScsIGRqYW5nby5jb250cmliLnBvc3RncmVzLmZpZWxkcy5qc29uYi5KU09ORmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSksCiAgICAgICAgICAgICAgICAoJ2Fib3V0TXlzZWxmJywgbW9kZWxzLlRleHRGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgndXBkYXRlZEF0X3V0YycsIG1vZGVscy5EYXRlVGltZUZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCd1cGRhdGVkQXRfb2Zmc2V0JywgbW9kZWxzLlRleHRGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgnY3JlYXRlZEF0X3V0YycsIG1vZGVscy5EYXRlVGltZUZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCdjcmVhdGVkQXRfb2Zmc2V0JywgbW9kZWxzLlRleHRGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgnY3JlYXRlZEJ5JywgbW9kZWxzLkZvcmVpZ25LZXkoYmxhbms9VHJ1ZSwgZGJfY29sdW1uPSdjcmVhdGVkQnknLCBudWxsPVRydWUsIG9uX2RlbGV0ZT1kamFuZ28uZGIubW9kZWxzLmRlbGV0aW9uLkRPX05PVEhJTkcsIHJlbGF0ZWRfbmFtZT0nKycsIHRvPSdfZGphbmdvX3NjaGVtYS51c2VyJykpLAogICAgICAgICAgICAgICAgKCd1cGRhdGVkQnknLCBtb2RlbHMuRm9yZWlnbktleShibGFuaz1UcnVlLCBkYl9jb2x1bW49J3VwZGF0ZWRCeScsIG51bGw9VHJ1ZSwgb25fZGVsZXRlPWRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24uRE9fTk9USElORywgcmVsYXRlZF9uYW1lPScrJywgdG89J19kamFuZ29fc2NoZW1hLnVzZXInKSksCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgIG9wdGlvbnM9ewogICAgICAgICAgICAgICAgJ2RiX3RhYmxlJzogJ1VzZXInLAogICAgICAgICAgICB9LAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5DcmVhdGVNb2RlbCgKICAgICAgICAgICAgbmFtZT0nb3JnYW5pemF0aW9udG91c2VybGluaycsCiAgICAgICAgICAgIGZpZWxkcz1bCiAgICAgICAgICAgICAgICAoJ2lkJywgbW9kZWxzLkF1dG9GaWVsZChwcmltYXJ5X2tleT1UcnVlLCBzZXJpYWxpemU9RmFsc2UpKSwKICAgICAgICAgICAgICAgICgnY29kZScsIG1vZGVscy5VVUlERmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlLCB1bmlxdWU9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCdlbWFpbCcsIG1vZGVscy5UZXh0RmllbGQoKSksCiAgICAgICAgICAgICAgICAoJ25hbWUnLCBtb2RlbHMuVGV4dEZpZWxkKGJsYW5rPVRydW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29sdW1uPSdvcmdhbml6YXRpb24nLCBvbl9kZWxldGU9ZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbi5ET19OT1RISU5HLCByZWxhdGVkX25hbWU9JysnLCB0bz0nX2RqYW5nb19zY2hlbWEub3JnYW5pemF0aW9uJykpLAogICAgICAgICAgICAgICAgKCd1cGRhdGVkQnknLCBtb2RlbHMuRm9yZWlnbktleShibGFuaz1UcnVlLCBkYl9jb2x1bW49J3VwZGF0ZWRCeScsIG51bGw9VHJ1ZSwgb25fZGVsZXRlPWRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24uRE9fTk9USElORywgcmVsYXRlZF9uYW1lPScrJywgdG89J19kamFuZ29fc2NoZW1hLnVzZXInKSksCiAgICAgICAgICAgICAgICAoJ3VzZXInLCBtb2RlbHMuRm9yZWlnbktleShibGFuaz1UcnVlLCBkYl9jb2x1bW49J3VzZXInLCBudWxsPVRydWUsIG9uX2RlbGV0ZT1kamFuZ28uZGIubW9kZWxzLmRlbGV0aW9uLkRPX05PVEhJTkcsIHJlbGF0ZWRfbmFtZT0nKycsIHRvPSdfZGphbmdvX3NjaGVtYS51c2VyJykpLAogICAgICAgICAgICBdLAogICAgICAgICAgICBvcHRpb25zPXsKICAgICAgICAgICAgICAgICdkYl90YWJsZSc6ICdPcmdhbml6YXRpb25Ub1VzZXJMaW5rJywKICAgICAgICAgICAgfSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWRkRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J29yZ2FuaXphdGlvbicsCiAgICAgICAgICAgIG5hbWU9J2NyZWF0ZWRCeScsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5Gb3JlaWduS2V5KGJsYW5rPVRydWUsIGRiX2NvbHVtbj0nY3JlYXRlZEJ5JywgbnVsbD1UcnVlLCBvbl9kZWxldGU9ZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbi5ET19OT1RISU5HLCByZWxhdGVkX25hbWU9JysnLCB0bz0nX2RqYW5nb19zY2hlbWEudXNlcicpLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BZGRGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0nb3JnYW5pemF0aW9uJywKICAgICAgICAgICAgbmFtZT0ndXBkYXRlZEJ5JywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLkZvcmVpZ25LZXkoYmxhbms9VHJ1ZSwgZGJfY29sdW1uPSd1cGRhdGVkQnknLCBudWxsPVRydWUsIG9uX2RlbGV0ZT1kamFuZ28uZGIubW9kZWxzLmRlbGV0aW9uLkRPX05PVEhJTkcsIHJlbGF0ZWRfbmFtZT0nKycsIHRvPSdfZGphbmdvX3NjaGVtYS51c2VyJyksCiAgICAgICAgKSwKICAgIF0K
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Create model organization
---
-CREATE TABLE "Organization" ("id" serial NOT NULL PRIMARY KEY, "name" text NOT NULL, "updatedAt_utc" timestamp with time zone NULL, "updatedAt_offset" text NULL, "createdAt_utc" timestamp with time zone NULL, "createdAt_offset" text NULL);
---
--- Create model user
---
-CREATE TABLE "User" ("id" serial NOT NULL PRIMARY KEY, "email" text NULL UNIQUE, "isEmailVerified" boolean NOT NULL, "isAdmin" boolean NOT NULL, "name" text NULL, "isActive" boolean NOT NULL, "password" varchar(60) NULL, "avatar" jsonb NULL, "dob" date NULL, "meta" jsonb NULL, "aboutMyself" text NULL, "updatedAt_utc" timestamp with time zone NULL, "updatedAt_offset" text NULL, "createdAt_utc" timestamp with time zone NULL, "createdAt_offset" text NULL, "createdBy" integer NULL, "updatedBy" integer NULL);
---
--- Create model organizationtouserlink
---
-CREATE TABLE "OrganizationToUserLink" ("id" serial NOT NULL PRIMARY KEY, "code" uuid NULL UNIQUE, "email" text NOT NULL, "name" text NULL, "role" varchar(50) NOT NULL, "isAccepted" boolean NULL, "isRejected" boolean NULL, "updatedAt_utc" timestamp with time zone NULL, "updatedAt_offset" text NULL, "createdAt_utc" timestamp with time zone NULL, "createdAt_offset" text NULL, "createdBy" integer NULL, "organization" integer NOT NULL, "updatedBy" integer NULL, "user" integer NULL);
---
--- Add field createdBy to organization
---
-ALTER TABLE "Organization" ADD COLUMN "createdBy" integer NULL CONSTRAINT "Organization_createdBy_1dd7d630_fk_User_id" REFERENCES "User"("id") DEFERRABLE INITIALLY DEFERRED; SET CONSTRAINTS "Organization_createdBy_1dd7d630_fk_User_id" IMMEDIATE;
---
--- Add field updatedBy to organization
---
-ALTER TABLE "Organization" ADD COLUMN "updatedBy" integer NULL CONSTRAINT "Organization_updatedBy_e4a88050_fk_User_id" REFERENCES "User"("id") DEFERRABLE INITIALLY DEFERRED; SET CONSTRAINTS "Organization_updatedBy_e4a88050_fk_User_id" IMMEDIATE;
-ALTER TABLE "User" ADD CONSTRAINT "User_createdBy_7f87595a_fk_User_id" FOREIGN KEY ("createdBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "User" ADD CONSTRAINT "User_updatedBy_998aac8b_fk_User_id" FOREIGN KEY ("updatedBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-CREATE INDEX "User_email_667201b5_like" ON "User" ("email" text_pattern_ops);
-CREATE INDEX "User_createdBy_7f87595a" ON "User" ("createdBy");
-CREATE INDEX "User_updatedBy_998aac8b" ON "User" ("updatedBy");
-ALTER TABLE "OrganizationToUserLink" ADD CONSTRAINT "OrganizationToUserLink_createdBy_2c72c4aa_fk_User_id" FOREIGN KEY ("createdBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "OrganizationToUserLink" ADD CONSTRAINT "OrganizationToUserLink_organization_047b72d2_fk_Organization_id" FOREIGN KEY ("organization") REFERENCES "Organization" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "OrganizationToUserLink" ADD CONSTRAINT "OrganizationToUserLink_updatedBy_758766b7_fk_User_id" FOREIGN KEY ("updatedBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "OrganizationToUserLink" ADD CONSTRAINT "OrganizationToUserLink_user_d86c251a_fk_User_id" FOREIGN KEY ("user") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-CREATE INDEX "OrganizationToUserLink_createdBy_2c72c4aa" ON "OrganizationToUserLink" ("createdBy");
-CREATE INDEX "OrganizationToUserLink_organization_047b72d2" ON "OrganizationToUserLink" ("organization");
-CREATE INDEX "OrganizationToUserLink_updatedBy_758766b7" ON "OrganizationToUserLink" ("updatedBy");
-CREATE INDEX "OrganizationToUserLink_user_d86c251a" ON "OrganizationToUserLink" ("user");
-CREATE INDEX "Organization_createdBy_1dd7d630" ON "Organization" ("createdBy");
-CREATE INDEX "Organization_updatedBy_e4a88050" ON "Organization" ("updatedBy");
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Add field updatedBy to organization
---
-ALTER TABLE "Organization" DROP COLUMN "updatedBy" CASCADE;
---
--- Add field createdBy to organization
---
-ALTER TABLE "Organization" DROP COLUMN "createdBy" CASCADE;
---
--- Create model organizationtouserlink
---
-DROP TABLE "OrganizationToUserLink" CASCADE;
---
--- Create model user
---
-DROP TABLE "User" CASCADE;
---
--- Create model organization
---
-DROP TABLE "Organization" CASCADE;
-COMMIT;
-
- `)
-}
diff --git a/apps/_ex02back/migrations/20210204185931-0002_auto_20210204_1559.js b/apps/_ex02back/migrations/20210204185931-0002_auto_20210204_1559.js
deleted file mode 100644
index 4acbfd61..00000000
--- a/apps/_ex02back/migrations/20210204185931-0002_auto_20210204_1559.js
+++ /dev/null
@@ -1,57 +0,0 @@
-// auto generated by kmigrator
-// KMIGRATOR:0002_auto_20210204_1559:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjEtMDItMDQgMTU6NTkKCmltcG9ydCBkamFuZ28uY29udHJpYi5wb3N0Z3Jlcy5maWVsZHMuanNvbmIKZnJvbSBkamFuZ28uZGIgaW1wb3J0IG1pZ3JhdGlvbnMsIG1vZGVscwppbXBvcnQgZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbgoKCmNsYXNzIE1pZ3JhdGlvbihtaWdyYXRpb25zLk1pZ3JhdGlvbik6CgogICAgZGVwZW5kZW5jaWVzID0gWwogICAgICAgICgnX2RqYW5nb19zY2hlbWEnLCAnMDAwMV9pbml0aWFsJyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkFkZEZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSdvcmdhbml6YXRpb24nLAogICAgICAgICAgICBuYW1lPSdhdmF0YXInLAogICAgICAgICAgICBmaWVsZD1kamFuZ28uY29udHJpYi5wb3N0Z3Jlcy5maWVsZHMuanNvbmIuSlNPTkZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFkZEZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSdvcmdhbml6YXRpb24nLAogICAgICAgICAgICBuYW1lPSdkZXNjcmlwdGlvbicsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5UZXh0RmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWRkRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J29yZ2FuaXphdGlvbnRvdXNlcmxpbmsnLAogICAgICAgICAgICBuYW1lPSdwaG9uZScsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5UZXh0RmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQ3JlYXRlTW9kZWwoCiAgICAgICAgICAgIG5hbWU9J2ZvcmdvdHBhc3N3b3JkYWN0aW9uJywKICAgICAgICAgICAgZmllbGRzPVsKICAgICAgICAgICAgICAgICgnaWQnLCBtb2RlbHMuQXV0b0ZpZWxkKHByaW1hcnlfa2V5PVRydWUsIHNlcmlhbGl6ZT1GYWxzZSkpLAogICAgICAgICAgICAgICAgKCd0b2tlbicsIG1vZGVscy5UZXh0RmllbGQodW5pcXVlPVRydWUpKSwKICAgICAgICAgICAgICAgICgncmVxdWVzdGVkQXRfdXRjJywgbW9kZWxzLkRhdGVUaW1lRmllbGQoKSksCiAgICAgICAgICAgICAgICAoJ3JlcXVlc3RlZEF0X29mZnNldCcsIG1vZGVscy5UZXh0RmllbGQoKSksCiAgICAgICAgICAgICAgICAoJ2V4cGlyZXNBdF91dGMnLCBtb2RlbHMuRGF0ZVRpbWVGaWVsZCgpKSwKICAgICAgICAgICAgICAgICgnZXhwaXJlc0F0X29mZnNldCcsIG1vZGVscy5UZXh0RmllbGQoKSksCiAgICAgICAgICAgICAgICAoJ3VzZWRBdF91dGMnLCBtb2RlbHMuRGF0ZVRpbWVGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgndXNlZEF0X29mZnNldCcsIG1vZGVscy5UZXh0RmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSksCiAgICAgICAgICAgICAgICAoJ3VwZGF0ZWRBdF91dGMnLCBtb2RlbHMuRGF0ZVRpbWVGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgndXBkYXRlZEF0X29mZnNldCcsIG1vZGVscy5UZXh0RmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSksCiAgICAgICAgICAgICAgICAoJ2NyZWF0ZWRBdF91dGMnLCBtb2RlbHMuRGF0ZVRpbWVGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgnY3JlYXRlZEF0X29mZnNldCcsIG1vZGVscy5UZXh0RmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSksCiAgICAgICAgICAgICAgICAoJ2NyZWF0ZWRCeScsIG1vZGVscy5Gb3JlaWduS2V5KGJsYW5rPVRydWUsIGRiX2NvbHVtbj0nY3JlYXRlZEJ5JywgbnVsbD1UcnVlLCBvbl9kZWxldGU9ZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbi5ET19OT1RISU5HLCByZWxhdGVkX25hbWU9JysnLCB0bz0nX2RqYW5nb19zY2hlbWEudXNlcicpKSwKICAgICAgICAgICAgICAgICgndXBkYXRlZEJ5JywgbW9kZWxzLkZvcmVpZ25LZXkoYmxhbms9VHJ1ZSwgZGJfY29sdW1uPSd1cGRhdGVkQnknLCBudWxsPVRydWUsIG9uX2RlbGV0ZT1kamFuZ28uZGIubW9kZWxzLmRlbGV0aW9uLkRPX05PVEhJTkcsIHJlbGF0ZWRfbmFtZT0nKycsIHRvPSdfZGphbmdvX3NjaGVtYS51c2VyJykpLAogICAgICAgICAgICAgICAgKCd1c2VyJywgbW9kZWxzLkZvcmVpZ25LZXkoYmxhbms9VHJ1ZSwgZGJfY29sdW1uPSd1c2VyJywgbnVsbD1UcnVlLCBvbl9kZWxldGU9ZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbi5ET19OT1RISU5HLCByZWxhdGVkX25hbWU9JysnLCB0bz0nX2RqYW5nb19zY2hlbWEudXNlcicpKSwKICAgICAgICAgICAgXSwKICAgICAgICAgICAgb3B0aW9ucz17CiAgICAgICAgICAgICAgICAnZGJfdGFibGUnOiAnRm9yZ290UGFzc3dvcmRBY3Rpb24nLAogICAgICAgICAgICB9LAogICAgICAgICksCiAgICBdCg==
-
-exports.up = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Add field avatar to organization
---
-ALTER TABLE "Organization" ADD COLUMN "avatar" jsonb NULL;
---
--- Add field description to organization
---
-ALTER TABLE "Organization" ADD COLUMN "description" text NULL;
---
--- Add field phone to organizationtouserlink
---
-ALTER TABLE "OrganizationToUserLink" ADD COLUMN "phone" text NULL;
---
--- Create model forgotpasswordaction
---
-CREATE TABLE "ForgotPasswordAction" ("id" serial NOT NULL PRIMARY KEY, "token" text NOT NULL UNIQUE, "requestedAt_utc" timestamp with time zone NOT NULL, "requestedAt_offset" text NOT NULL, "expiresAt_utc" timestamp with time zone NOT NULL, "expiresAt_offset" text NOT NULL, "usedAt_utc" timestamp with time zone NULL, "usedAt_offset" text NULL, "updatedAt_utc" timestamp with time zone NULL, "updatedAt_offset" text NULL, "createdAt_utc" timestamp with time zone NULL, "createdAt_offset" text NULL, "createdBy" integer NULL, "updatedBy" integer NULL, "user" integer NULL);
-ALTER TABLE "ForgotPasswordAction" ADD CONSTRAINT "ForgotPasswordAction_createdBy_c0278297_fk_User_id" FOREIGN KEY ("createdBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "ForgotPasswordAction" ADD CONSTRAINT "ForgotPasswordAction_updatedBy_60e6cb54_fk_User_id" FOREIGN KEY ("updatedBy") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE "ForgotPasswordAction" ADD CONSTRAINT "ForgotPasswordAction_user_3c52ec86_fk_User_id" FOREIGN KEY ("user") REFERENCES "User" ("id") DEFERRABLE INITIALLY DEFERRED;
-CREATE INDEX "ForgotPasswordAction_token_9a0cc9b4_like" ON "ForgotPasswordAction" ("token" text_pattern_ops);
-CREATE INDEX "ForgotPasswordAction_createdBy_c0278297" ON "ForgotPasswordAction" ("createdBy");
-CREATE INDEX "ForgotPasswordAction_updatedBy_60e6cb54" ON "ForgotPasswordAction" ("updatedBy");
-CREATE INDEX "ForgotPasswordAction_user_3c52ec86" ON "ForgotPasswordAction" ("user");
-COMMIT;
-
- `)
-}
-
-exports.down = async (knex) => {
- await knex.raw(`
- BEGIN;
---
--- Create model forgotpasswordaction
---
-DROP TABLE "ForgotPasswordAction" CASCADE;
---
--- Add field phone to organizationtouserlink
---
-ALTER TABLE "OrganizationToUserLink" DROP COLUMN "phone" CASCADE;
---
--- Add field description to organization
---
-ALTER TABLE "Organization" DROP COLUMN "description" CASCADE;
---
--- Add field avatar to organization
---
-ALTER TABLE "Organization" DROP COLUMN "avatar" CASCADE;
-COMMIT;
-
- `)
-}
diff --git a/apps/_ex02back/multi-app-support.js b/apps/_ex02back/multi-app-support.js
deleted file mode 100644
index 0ec250a9..00000000
--- a/apps/_ex02back/multi-app-support.js
+++ /dev/null
@@ -1,18 +0,0 @@
-const { prepareKeystoneExpressApp } = require('@core/keystone/test.utils')
-
-const URL_PREFIX = '/'
-const NAME = 'BACK02KEYSTONE'
-
-async function prepareBackServer (server) {}
-
-async function prepareBackApp () {
- const { app } = await prepareKeystoneExpressApp(require.resolve('./index'))
- return app
-}
-
-module.exports = {
- NAME,
- URL_PREFIX,
- prepareBackApp,
- prepareBackServer,
-}
diff --git a/apps/_ex02back/package.json b/apps/_ex02back/package.json
deleted file mode 100644
index 2796a999..00000000
--- a/apps/_ex02back/package.json
+++ /dev/null
@@ -1,39 +0,0 @@
-{
- "name": "@app/ex02back",
- "version": "2.0.0",
- "private": true,
- "scripts": {
- "test": "jest --testTimeout=10000",
- "dev": "nodemon --exec keystone dev",
- "debug": "node inspect node_modules/.bin/keystone dev",
- "build": "keystone build",
- "start": "keystone start",
- "makemigrations": "./../../bin/kmigrator.py makemigrations",
- "migrate": "./../../bin/kmigrator.py migrate"
- },
- "dependencies": {
- "@keystonejs/adapter-knex": "^12.0.2",
- "@keystonejs/adapter-mongoose": "^10.0.1",
- "@keystonejs/adapter-prisma": "^1.1.2",
- "@keystonejs/app-admin-ui": "^7.3.9",
- "@keystonejs/app-graphql": "^6.1.0",
- "@keystonejs/app-next": "^5.2.1",
- "@keystonejs/app-static": "^5.1.2",
- "@keystonejs/auth-password": "^5.1.17",
- "@keystonejs/fields-wysiwyg-tinymce": "^5.3.13",
- "@keystonejs/file-adapters": "^7.0.3",
- "@keystonejs/keystone": "^17.1.1",
- "@keystonejs/server-side-graphql-client": "^1.1.2",
- "@keystonejs/utils": "^6.0.1",
- "@keystonejs/fields-color": "^1.0.7",
- "@keystonejs/fields-content": "^9.0.2",
- "@keystonejs/fields-location-google": "^3.0.2",
- "@keystonejs/list-plugins": "^7.1.4",
- "date-fns": "^2.15.0",
- "firebase-admin": "^9.1.1",
- "jest": "^26.6.3",
- "nodemon": "^2.0.7",
- "validator": "^13.1.1"
- },
- "repository": "https://github.com/pahaz/hackathon-boilerplate-starter-kit/tree/master/apps/_ex02back"
-}
diff --git a/apps/_ex02back/schema/Organization.js b/apps/_ex02back/schema/Organization.js
deleted file mode 100644
index b2575f5a..00000000
--- a/apps/_ex02back/schema/Organization.js
+++ /dev/null
@@ -1,68 +0,0 @@
-const { Wysiwyg } = require('@keystonejs/fields-wysiwyg-tinymce')
-const { LocalFileAdapter } = require('@keystonejs/file-adapters')
-const { File, Text } = require('@keystonejs/fields')
-
-const conf = require('@core/config')
-const { ...OrganizationSchemas } = require('@core/keystone/schemas/Organization')
-const { Organization: BaseOrganization } = require('@core/keystone/schemas/Organization')
-const { OrganizationToUserLink: BaseOrganizationToUserLink } = require('@core/keystone/schemas/Organization')
-const { RegisterNewOrganizationService: BaseRegisterNewOrganizationService } = require('@core/keystone/schemas/Organization')
-const { InviteNewUserToOrganizationService: BaseInviteNewUserToOrganizationService } = require('@core/keystone/schemas/Organization')
-
-const AVATAR_FILE_ADAPTER = new LocalFileAdapter({
- src: `${conf.MEDIA_ROOT}/orgavatars`,
- path: `${conf.MEDIA_URL}/orgavatars`,
-})
-
-const Organization = BaseOrganization._override({
- fields: {
- avatar: { type: File, adapter: AVATAR_FILE_ADAPTER },
- description: {
- type: Wysiwyg,
- },
- },
-})
-
-const OrganizationToUserLink = BaseOrganizationToUserLink._override({
- fields: {
- phone: {
- type: Text,
- hooks: {
- resolveInput: async ({ resolvedData }) => {
- return resolvedData['phone'] && resolvedData['phone'].toLowerCase().replace(/\D/g, '')
- },
- },
- },
- },
-})
-
-const RegisterNewOrganizationService = BaseRegisterNewOrganizationService._override({
- types: [
- {
- access: true,
- type: 'input RegisterNewOrganizationInput { name: String!, description: String!, avatar: Upload }',
- },
- ],
-})
-
-const InviteNewUserToOrganizationService = BaseInviteNewUserToOrganizationService._override({
- types: [
- {
- access: true,
- type: 'input InviteNewUserToOrganizationInput { organization: OrganizationWhereUniqueInput!, name: String, email: String!, phone: String }',
- },
- ],
-})
-
-InviteNewUserToOrganizationService.on('afterInviteNewUserToOrganization', ({ parent, args, context, info, extra, result }) => {
- // NOTE: send invite link by email!
- console.log('Fake send security email!', JSON.stringify(result))
-})
-
-module.exports = {
- ...OrganizationSchemas,
- Organization,
- OrganizationToUserLink,
- RegisterNewOrganizationService,
- InviteNewUserToOrganizationService,
-}
diff --git a/apps/_ex02back/schema/User.js b/apps/_ex02back/schema/User.js
deleted file mode 100644
index 50ae06dd..00000000
--- a/apps/_ex02back/schema/User.js
+++ /dev/null
@@ -1,26 +0,0 @@
-const { Wysiwyg } = require('@keystonejs/fields-wysiwyg-tinymce')
-const { LocalFileAdapter } = require('@keystonejs/file-adapters')
-const { File } = require('@keystonejs/fields')
-
-const conf = require('@core/config')
-const { ...UserSchemas } = require('@core/keystone/schemas/User')
-const { User: BaseUser } = require('@core/keystone/schemas/User')
-const { Json } = require('@core/keystone/fields')
-
-const AVATAR_FILE_ADAPTER = new LocalFileAdapter({
- src: `${conf.MEDIA_ROOT}/avatars`,
- path: `${conf.MEDIA_URL}/avatars`,
-})
-
-const User = BaseUser._override({
- fields: {
- avatar: { type: File, adapter: AVATAR_FILE_ADAPTER },
- meta: { type: Json },
- aboutMyself: { type: Wysiwyg },
- },
-})
-
-module.exports = {
- ...UserSchemas,
- User,
-}
diff --git a/apps/_ex02front/babel.config.js b/apps/_ex02front/babel.config.js
deleted file mode 100644
index f1dc37a3..00000000
--- a/apps/_ex02front/babel.config.js
+++ /dev/null
@@ -1,6 +0,0 @@
-module.exports = function (api) {
- api.cache(true)
- return {
- 'presets': ['next/babel'],
- }
-}
diff --git a/apps/_ex02front/containers/AuthRequired.js b/apps/_ex02front/containers/AuthRequired.js
deleted file mode 100644
index 0cafdf72..00000000
--- a/apps/_ex02front/containers/AuthRequired.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/** @jsx jsx */
-import { css, jsx } from '@emotion/core'
-import { Spin, Typography } from 'antd'
-import { LoadingOutlined } from '@ant-design/icons'
-import { useEffect } from 'react'
-import Router, { useRouter } from 'next/router'
-import qs from 'qs'
-import { useAuth } from '@core/next/auth'
-import { useIntl } from '@core/next/intl'
-
-import { isFunction } from '../utils/ecmascript.utils'
-
-function RedirectToLogin () {
- const { asPath } = useRouter()
-
- const intl = useIntl()
- const RedirectingMsg = intl.formatMessage({ id: 'Redirecting' })
-
- useEffect(() => {
- const clearHandle = setTimeout(() => {
- Router.push('/auth/signin?' + qs.stringify({ next: asPath }))
- }, 200)
- return () => {
- clearTimeout(clearHandle)
- }
- })
- return {RedirectingMsg}
-}
-
-export function AuthRequired ({ children }) {
- const auth = useAuth()
- const { isAuthenticated, isLoading } = auth
-
- const intl = useIntl()
- const SignInRequiredMsg = intl.formatMessage({ id: 'SignInRequired' })
-
- if (isLoading) {
- const antIcon =
- return
- }
-
- if (!isAuthenticated) {
- return <>
- {SignInRequiredMsg}
-
- >
- }
-
- if (isFunction(children)) {
- return children(auth)
- }
-
- return children
-}
diff --git a/apps/_ex02front/containers/BaseLayout/BaseLayout.jsx b/apps/_ex02front/containers/BaseLayout/BaseLayout.jsx
deleted file mode 100644
index 9daa6913..00000000
--- a/apps/_ex02front/containers/BaseLayout/BaseLayout.jsx
+++ /dev/null
@@ -1,287 +0,0 @@
-/** @jsx jsx */
-import { css, jsx } from '@emotion/core'
-import { createContext, useContext, useState } from 'react'
-import { ConfigProvider, Drawer, Layout, Menu, PageHeader as AntPageHeader } from 'antd'
-import { DashboardOutlined } from '@ant-design/icons'
-import Router from 'next/router'
-import enUS from 'antd/lib/locale/en_US'
-import ruRU from 'antd/lib/locale/ru_RU'
-
-import './antd-custom.less'
-import TopMenuItems from './components/TopMenuItems'
-import { useIntl } from '@core/next/intl'
-import { useAntdMediaQuery } from '../../utils/mediaQuery.utils'
-
-const LayoutContext = createContext({})
-const useLayoutContext = () => useContext(LayoutContext)
-const { Header, Sider, Content } = Layout
-const { SubMenu } = Menu
-
-const ANT_DEFAULT_LOCALE = enUS
-const ANT_LOCALES = {
- ru: ruRU,
- en: enUS,
-}
-
-const DEFAULT_MENU = [
- {
- path: '/',
- icon: ,
- locale: 'menu.Home',
- },
- {
- path: '/auth/signin',
- locale: 'menu.Auth',
- hideInMenu: true,
- children: [
- {
- path: '/auth/signin',
- locale: 'menu.SignIn',
- },
- {
- path: '/auth/register',
- locale: 'menu.SignUp',
- },
- {
- path: '/auth/forgot',
- locale: 'menu.ResetPassword',
- },
- {
- path: '/auth/change-password',
- locale: 'menu.ChangePassword',
- },
- ],
- },
-]
-
-const layoutCss = css`
- height: 100%;
- display: flex;
- align-items: stretch;
-`
-
-const subLayoutCss = css`
- width: 100%;
- display: flex;
- align-items: stretch;
-`
-
-const sideMenuSiderCss = css`
- z-index: 10;
- box-shadow: 2px 0 6px rgba(0,21,41,.35);
- min-height: 100%;
-`
-
-const sideMenuLogoCss = css`
- height: 64px;
- margin: 0 24px;
- cursor: pointer;
-
- transition: all 0.2s;
- filter: brightness(10);
-
- .ant-layout-sider-collapsed & {
- height: 48px;
- margin: 8px 16px;
- }
-`
-
-const topMenuCss = css`
- z-index: 9;
- background: #fff;
- padding: 0;
- box-shadow: 2px 0 6px rgba(0,21,41,.35);
- min-width: 100%;
- clear: both;
-`
-
-const topMenuLogoCss = css`
- float: left;
- height: 64px;
- margin: 0 24px;
- cursor: pointer;
-
- @media (max-width: 768px) {
- margin: 0 12px;
- border-radius: 0;
- }
- @media (max-width: 480px) {
- margin: 0 12px;
- border-radius: 0;
- }
-`
-
-const pageWrapperCss = css`
- margin: 0;
- padding: 0;
-`
-
-const pageHeaderCss = css`
- margin: 0 24px 24px;
- padding: 24px;
- background: #fff;
-
- @media (max-width: 768px) {
- margin: 0 0 12px;
- }
- @media (max-width: 480px) {
- margin: 0 0 12px;
- }
-`
-
-const pageContentCss = css`
- margin: 24px;
- padding: 24px;
- background: #fff;
- border-radius: 2px;
-
- @media (max-width: 768px) {
- margin: 12px 0;
- border-radius: 0;
- }
- @media (max-width: 480px) {
- margin: 12px 0;
- border-radius: 0;
- }
-`
-
-function renderMenuData (menuData, menuItemRender, localeRender, onClickMenuItem) {
- return menuData.map((item) => {
- if (item.hideInMenu) return null
- const text = item.locale ? localeRender(item.locale) : item.name
- return (
- (item.children && !item.hideChildrenInMenu) ?
- onClickMenuItem(item)}>
- {renderMenuData(item.children, menuItemRender, localeRender, onClickMenuItem)}
-
- :
- onClickMenuItem(item)}>
- {menuItemRender(item, text)}
-
- )
- })
-}
-
-function SideMenu ({ logoLocation, onLogoClick, menuData, menuItemRender, localeRender, onClickMenuItem, sideMenuWidth, isMobile, isSideMenuCollapsed, toggleSideMenuCollapsed }) {
- const logo =
- const menu =
- return isMobile ? (
-
-
- {logo}{menu}
-
-
- ) : (
-
- {(logoLocation === 'sideMenu') ? logo : null}{menu}
-
- )
-}
-
-function BaseLayout ({ children, logoLocation = 'sideMenu', className, style, ...props }) {
- // .layout { .top-menu .side-menu .page-wrapper { .page-header .page-content } }
- // try to be compatible with https://github.com/ant-design/ant-design-pro-layout/blob/master/README.md#api
- const intl = useIntl()
- const colSize = useAntdMediaQuery()
- const isMobile = (colSize === 'xs') && !props.disableMobile
- console.log(isMobile, colSize)
-
- const localeRender = (locale) => intl.formatMessage({ id: locale })
- const menuDataRender = props.menuDataRender || (() => DEFAULT_MENU)
- const menuItemRender = props.menuItemRender || ((props, item) => item)
- const onLogoClick = props.onLogoClick || (() => Router.push('/'))
- const onClickMenuItem = props.onClickMenuItem || ((item) => (item.children) ? null : Router.push(item.path))
- const menuData = menuDataRender()
- const isMenuEmpty = !menuData || menuData.length === 0
-
- const sideMenuWidth = 200
-
- const [isSideMenuCollapsed, setIsSideMenuCollapsed] = useState((isMobile) ? false : true)
-
- function toggleSideMenuCollapsed () {
- setIsSideMenuCollapsed(!isSideMenuCollapsed)
- }
-
- // FIXES
- if (isMenuEmpty) {
- logoLocation = 'topMenu'
- className = className + ' hided-side-menu'
- }
-
- // TODO(pahaz): should we move locale logic from here to other place? (Like AntLocale ?)
- return (
-
-
-
-
-
- {logoLocation === 'topMenu' ? : null}
-
-
- {children}
-
-
-
- )
-}
-
-function PageWrapper ({ children, className, style }) {
- return
- {children}
-
-}
-
-function PageHeader ({ children, className, style, title, subTitle }) {
- return
- {children}
-
-}
-
-function PageContent ({ children, className, style }) {
- return
- {children}
-
-}
-
-export default BaseLayout
-export {
- useLayoutContext,
- PageWrapper,
- PageHeader,
- PageContent,
-}
diff --git a/apps/_ex02front/containers/BaseLayout/TopMenuOnlyLayout.jsx b/apps/_ex02front/containers/BaseLayout/TopMenuOnlyLayout.jsx
deleted file mode 100644
index 82691717..00000000
--- a/apps/_ex02front/containers/BaseLayout/TopMenuOnlyLayout.jsx
+++ /dev/null
@@ -1,17 +0,0 @@
-import React from 'react'
-
-import BaseLayout, { PageContent, PageWrapper } from './BaseLayout'
-
-function TopMenuOnlyLayout ({ children, ...props }) {
- return
-
- {children}
-
-
-}
-
-export default TopMenuOnlyLayout
diff --git a/apps/_ex02front/containers/BaseLayout/antd-custom.less b/apps/_ex02front/containers/BaseLayout/antd-custom.less
deleted file mode 100644
index fc51b3de..00000000
--- a/apps/_ex02front/containers/BaseLayout/antd-custom.less
+++ /dev/null
@@ -1,11 +0,0 @@
-@import '~antd/es/style/themes/default';
-//@import '~antd/es/style/themes/dark';
-//@import '~antd/es/style/themes/compact';
-
-// Ant customization
-// https://ant.design/docs/react/customize-theme
-@primary-color: #C02428;
-
-// Global ANTD ALL
-@import '~antd/lib/style/core/index';
-@import '~antd/lib/style/components';
diff --git a/apps/_ex02front/containers/BaseLayout/components/TopMenuItems.jsx b/apps/_ex02front/containers/BaseLayout/components/TopMenuItems.jsx
deleted file mode 100644
index 52fca189..00000000
--- a/apps/_ex02front/containers/BaseLayout/components/TopMenuItems.jsx
+++ /dev/null
@@ -1,143 +0,0 @@
-import { Avatar, Dropdown, Menu, Spin, Tag } from 'antd'
-import { LogoutOutlined, MenuUnfoldOutlined } from '@ant-design/icons'
-import Router from 'next/router'
-import { useAuth } from '@core/next/auth'
-import { useIntl } from '@core/next/intl'
-import { useOrganization } from '@core/next/organization'
-import styled from '@emotion/styled'
-
-const TopMenuLeftWrapper = styled.div`
- float: left;
- height: 100%;
- overflow: hidden;
-`
-
-const TopMenuRightWrapper = styled.div`
- float: right;
- height: 100%;
- margin-left: auto;
- overflow: hidden;
-`
-
-const TopMenuItem = styled.div`
- display: inline-block;
- height: 100%;
- padding: 0 24px;
- cursor: pointer;
- transition: all 0.3s;
- > i {
- vertical-align: middle;
- }
- &:hover {
- background: rgba(0, 0, 0, 0.025);
- }
- .avatar {
- margin-right: 8px;
- }
-
- @media (max-width: 768px) {
- padding: 0 12px;
- }
- @media (max-width: 480px) {
- .name {
- display: none;
- }
- .avatar {
- margin-right: 0;
- }
- .tag {
- display: none;
- }
- .ellipsable180 {
- max-width: 180px;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- }
-`
-
-function goToSignin () {
- Router.push('/auth/signin')
-}
-
-function goToOrganization () {
- Router.push('/organizations')
-}
-
-function TopMenuItems ({ isMobile, isSideMenuCollapsed, toggleSideMenuCollapsed }) {
- const auth = useAuth()
- const org = useOrganization()
- const withDropdownMenu = true
- const avatarUrl = (auth.user && auth.user.avatar && auth.user.avatar.publicUrl) ? auth.user.avatar.publicUrl : 'https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png'
-
- const intl = useIntl()
- const SignOutMsg = intl.formatMessage({ id: 'SignOut' })
- const SignInMsg = intl.formatMessage({ id: 'SignIn' })
- const AvatarMsg = intl.formatMessage({ id: 'Avatar' })
- const OwnerMsg = intl.formatMessage({ id: 'Owner' })
- const GuestUsernameMsg = intl.formatMessage({ id: 'baselayout.menuheader.GuestUsername' })
-
- if (org && org.isLoading || auth.isLoading) {
- return (
-
-
-
- )
- }
-
- const menu = (
-
- )
-
- const avatar = (
-
-
- {auth.user ? auth.user.name : GuestUsernameMsg}
-
- )
-
- const sigin = (
-
- {SignInMsg}
-
- )
-
- const signedInItems = withDropdownMenu ? ({avatar}) : (avatar)
- const signedOutItems = (sigin)
-
- const organizationName = (org && org.organization) ?
-
-
- {org.organization.name}{' '}
- {(org.link && org.link.role === 'owner') ?
- {OwnerMsg}
- :
- null}
-
-
- : null
-
- const menuCollapser = isMobile ?
-
- : null
-
- return (<>
- {menuCollapser}
- {organizationName}
-
- {auth.isAuthenticated ? signedInItems : signedOutItems}
-
- >)
-}
-
-export default TopMenuItems
diff --git a/apps/_ex02front/containers/BaseLayout/index.js b/apps/_ex02front/containers/BaseLayout/index.js
deleted file mode 100644
index 4d9a9710..00000000
--- a/apps/_ex02front/containers/BaseLayout/index.js
+++ /dev/null
@@ -1,9 +0,0 @@
-import BaseLayout, { PageContent, PageHeader, PageWrapper, useLayoutContext } from './BaseLayout'
-import TopMenuOnlyLayout from './TopMenuOnlyLayout'
-
-export default BaseLayout
-export {
- TopMenuOnlyLayout,
- useLayoutContext,
- PageWrapper, PageHeader, PageContent,
-}
diff --git a/apps/_ex02front/containers/Chat.jsx b/apps/_ex02front/containers/Chat.jsx
deleted file mode 100644
index 0aaa42e9..00000000
--- a/apps/_ex02front/containers/Chat.jsx
+++ /dev/null
@@ -1,240 +0,0 @@
-/** @jsx jsx */
-import { css, Global, jsx } from '@emotion/core'
-import { useEffect, useRef, useState } from 'react'
-import { Input } from 'antd'
-import { SendOutlined } from '@ant-design/icons'
-import QueueAnim from 'rc-queue-anim'
-import { useImmer } from 'use-immer'
-import socketIOClient from 'socket.io-client'
-
-const CHAT_SERVER_URL = 'http://localhost:3000/'
-const CHAT_DEBUG = false
-
-function MessageList ({ messages, user }) {
- const $messagesContainer = useRef(null)
- const $endOfMessages = useRef(null)
-
- useEffect(() => {
- // we need to wait before an animation
- setTimeout(() => {
- if ($endOfMessages.current) $endOfMessages.current.scrollIntoView({ behavior: 'smooth' })
- }, 320)
- }, [messages])
-
- function handleEndAnimation () {
- $messagesContainer.current.scrollTop = 99999
- }
-
- const items = messages.map((msg) => {
- return (
-
-
- {msg.message}
-
-
- )
- })
-
- return (
-
-
- {items}
-
-
-
- )
-}
-
-function MessageInput ({ onSendMessage }) {
- const [message, setMessage] = useState('')
-
- function handleEnter (e) {
- e.preventDefault()
- if (!message) return
- setMessage('')
- onSendMessage(message)
- }
-
- return (
-
-
- {setMessage(e.target.value)}} value={message}
- placeholder="Type something ..."/>
-
-
-
- )
-}
-
-function Chat () {
- const [messages, setMessages] = useImmer([])
- const [user, setUser] = useState('unknown')
- const [socket, setSocket] = useState(null)
-
- useEffect(() => {
- if (CHAT_DEBUG) console.log('chat', 'init')
- const socket = socketIOClient(CHAT_SERVER_URL)
- socket.on('connect', () => {
- if (CHAT_DEBUG) console.log('chat', socket.id, 'connected')
- setUser(socket.id)
- setSocket(socket)
- })
- socket.on('chat message', (msg) => {
- if (CHAT_DEBUG) console.log('chat', socket.id, 'receive', msg)
- setMessages(messages => {messages.push(msg)})
- })
- return () => {
- if (CHAT_DEBUG) console.log('chat', socket.id, 'destroyed')
- socket.removeAllListeners()
- socket.close()
- setSocket(null)
- }
- }, [])
-
- function handleSendMessage (message) {
- const msg = { user, message, id: `${Date.now()}-${Math.random()}` }
- socket && socket.emit('chat message', msg)
- if (CHAT_DEBUG) console.log('chat', (socket) ? socket.id : null, 'send', msg)
- }
-
- return (<>
-
-
-
-
-
- >)
-}
-
-export default Chat
\ No newline at end of file
diff --git a/apps/_ex02front/containers/FormBlocks.js b/apps/_ex02front/containers/FormBlocks.js
deleted file mode 100644
index 18f2aa73..00000000
--- a/apps/_ex02front/containers/FormBlocks.js
+++ /dev/null
@@ -1,51 +0,0 @@
-import { useApolloClient } from '@core/next/apollo'
-import { useEffect, useMemo, useState } from 'react'
-import { Select } from 'antd'
-
-function SearchInput ({ search, ...props }) {
- const client = useApolloClient()
- const [selected, setSelected] = useState('')
- const [data, setData] = useState([])
- const [value, setValue] = useState('')
- const options = useMemo(
- () => data.map(d =>
{d.text}),
- [data, value],
- )
-
- async function handleSearch (value) {
- const data = await search(client, (selected) ? selected + ' ' + value : value)
- if (data.length) setData(data)
- setValue(value)
- }
-
- function handleSelect (value, options) {
- setSelected(options.children)
- }
-
- function handleClear () {
- setSelected('')
- }
-
- useEffect(() => {
- handleSearch('')
- }, [])
-
- return
-}
-
-export {
- SearchInput,
-}
diff --git a/apps/_ex02front/containers/FormList.js b/apps/_ex02front/containers/FormList.js
deleted file mode 100644
index bf637c35..00000000
--- a/apps/_ex02front/containers/FormList.js
+++ /dev/null
@@ -1,330 +0,0 @@
-import { Button, Dropdown, Form, Input, List, Menu, Modal, Popconfirm, Skeleton, Typography } from 'antd'
-import { DownOutlined, PlusOutlined } from '@ant-design/icons'
-import styled from '@emotion/styled'
-import React, { useState } from 'react'
-import { useIntl } from '@core/next/intl'
-import { useMutation } from '@core/next/apollo'
-
-import { runMutation } from '../utils/mutations.utils'
-
-const identity = (x) => !!x
-const NON_FIELD_ERROR_NAME = '_NON_FIELD_ERROR_'
-
-class ValidationError extends Error {
- constructor (message, field = NON_FIELD_ERROR_NAME) {
- super(message)
- this.name = 'ValidationError'
- this.field = field
- }
-}
-
-const SListItemForm = styled(Form)`
- width: 100%;
- display: flex;
- flex-flow: row wrap;
- justify-content: center;
- align-items: stretch;
- align-content: stretch;
-`
-
-const SListItem = styled(List.Item)`
- padding: 0 !important;
-`
-
-const SListItemMeta = styled(List.Item.Meta)`
- flex: 1 0 55%;
- margin: 16px 24px;
-`
-
-const SListItemExtra = styled.div`
- flex: none;
- margin: 16px 24px;
-
- & ul:first-child {
- margin-top: 0;
- }
-`
-
-const SSkeleton = styled(Skeleton)`
- margin: 16px 24px;
-`
-
-const SListActionsUl = styled.ul`
- margin: 10px 10px 0;
- text-align: center;
-
- > li {
- margin: 0;
- }
-`
-
-function FormList ({ dataSource, renderItem, ...extra }) {
- if (!renderItem) throw new Error('renderItem prop is required')
-
- return
-
- function renderItemWrapper (item) {
- const itemData = renderItem(item)
- const itemMeta = { key: item.id, ...(itemData.itemMeta || {}) }
- const formMeta = { layout: 'inline', ...(itemData.formMeta || {}) }
- const mainBlockMeta = { key: `m${item.id}`, ...(itemData.mainBlockMeta || {}) }
- const extraBlockMeta = { key: `e${item.id}`, ...(itemData.extraBlockMeta || {}) }
- return
-
-
-
-
- {(itemData.actions && Array.isArray(itemData.actions)) ?
- itemData.actions
- .map((actionsLine, i) => {
- if (!actionsLine) return null
- if (!Array.isArray(actionsLine)) throw new Error('renderItem() => itemData.actions should be array of arrays')
- const cleanedActionsLine = actionsLine.filter(identity)
- const length = cleanedActionsLine.length
- if (length === 0) return null
- return
- {cleanedActionsLine
- .map((action, j) => {
- if (!action) return null
- return
- {action}
- {j !== length - 1 && }
-
- })
- }
-
- })
- .filter(identity)
- : itemData.actions}
-
-
-
-
- }
-}
-
-function CreateFormListItemButton ({ label, ...extra }) {
- return
-}
-
-function ExtraDropdownActionsMenu ({ actions }) {
- const actionsLine = actions.filter(identity)
- const [popConfirmProps, setPopConfirmProps] = useState({ visible: false, title: null, icon: null })
-
- function handleAction ({ key }) {
- const action = actionsLine[key]
- if (action.confirm) {
- setPopConfirmProps({
- visible: true,
- onConfirm: action.action,
- onCancel: () => setPopConfirmProps({ visible: false, title: null, icon: null }),
- ...action.confirm,
- })
- } else {
- setPopConfirmProps({ visible: false, title: null, icon: null })
- action.action()
- }
- }
-
- return
-
- {actionsLine.map((action, i) => {action.label})}
- }>
- ...
-
-
-}
-
-function ExpandableDescription ({ children }) {
- const intl = useIntl()
- const ReadMoreMsg = intl.formatMessage({ id: 'ReadMore' })
- return
- {children}
-
-}
-
-function useCreateAndEditModalForm () {
- const [visible, setIsModalVisible] = useState(false)
- const [editableItem, setModalObject] = useState(null)
-
- function openCreateModal () {
- setIsModalVisible(true)
- setModalObject(null)
- }
-
- function openEditModal (item) {
- setIsModalVisible(true)
- setModalObject(item)
- }
-
- function cancelModal () {
- setIsModalVisible(false)
- setModalObject(null)
- }
-
- return { visible, editableItem, openCreateModal, openEditModal, cancelModal }
-}
-
-function CreateModalFormWithButton ({ CreateButtonLabelMsg, OnCreatedMsg, ...props }) { // eslint-disable-line no-unused-vars
- // TODO(pahaz): use it somewhere as example! (and remove eslint-disable-line)
- const { visible, openCreateModal, cancelModal } = useCreateAndEditModalForm()
-
- const intl = useIntl()
- const CreateMsg = intl.formatMessage({ id: 'Create' })
- const CreatedMsg = intl.formatMessage({ id: 'Created' })
- const SaveMsg = intl.formatMessage({ id: 'Save' })
-
- return <>
-
-
- >
-}
-
-function CRUDListBlock () { // eslint-disable-line no-unused-vars
- // TODO(pahaz): inside organizations logic here (and remove eslint-disable-line)
-}
-
-function BaseModalForm ({ action, mutation, mutationExtraVariables, mutationExtraData, mutationOptions, formValuesToMutationDataPreprocessor, formValuesToMutationDataPreprocessorContext, formInitialValues, children, onMutationCompleted, onFormValuesChange, modalExtraFooter = [], visible, cancelModal, ModalTitleMsg, ModalCancelButtonLabelMsg, ModalSaveButtonLabelMsg, ErrorToFormFieldMsgMapping, OnErrorMsg, OnCompletedMsg }) {
- // TODO(pahaz): refactor all (mutation, mutationExtraVariables, mutationOptions, mutationExtraData) and remove it
- if (mutationOptions) throw new Error('mutationOptions is not supported!')
- if (!children) throw new Error('need to define Form.Item inside ModalForm')
- if (!mutation && !action) throw new Error('need to pass mutation or action prop')
- if (action && mutation) throw new Error('impossible to pass mutation and action prop')
- if (action && mutationExtraVariables) throw new Error('impossible to pass action and mutationExtraVariables prop')
- if (action && mutationExtraData) throw new Error('impossible to pass action and mutationExtraData prop')
- if (typeof visible === 'undefined') throw new Error('need to pass visible prop')
- if (typeof cancelModal === 'undefined') throw new Error('need to pass cancelModal prop')
- if (!mutationExtraData) mutationExtraData = {}
- if (!mutationExtraVariables) mutationExtraVariables = {}
- if (typeof mutationExtraData !== 'object') throw new Error('wrong mutationExtraData prop')
- if (typeof mutationExtraVariables !== 'object') throw new Error('wrong mutationExtraVariables prop')
-
- const [form] = Form.useForm()
- const [isLoading, setIsLoading] = useState(false)
- let create = null
- if (!action) {
- [create] = useMutation(mutation) // eslint-disable-line react-hooks/rules-of-hooks
- }
-
- const intl = useIntl()
- const CancelMsg = intl.formatMessage({ id: 'Cancel' })
- const SaveMsg = intl.formatMessage({ id: 'Save' })
- const ClientSideErrorMsg = intl.formatMessage({ id: 'ClientSideError' })
-
- function handleFormSubmit (values) {
- if (values.hasOwnProperty(NON_FIELD_ERROR_NAME)) delete values[NON_FIELD_ERROR_NAME]
- let data
- try {
- data = (formValuesToMutationDataPreprocessor) ? formValuesToMutationDataPreprocessor(values, formValuesToMutationDataPreprocessorContext) : values
- } catch (err) {
- if (err instanceof ValidationError) {
- let errors = []
- if (ErrorToFormFieldMsgMapping) {
- const errorString = `${err}`
- Object.keys(ErrorToFormFieldMsgMapping).forEach((msg) => {
- if (errorString.includes(msg)) {
- errors.push(ErrorToFormFieldMsgMapping[msg])
- }
- })
- }
- if (errors.length === 0) {
- errors = [{ name: err.field || NON_FIELD_ERROR_NAME, errors: [String(err.message)] }]
- }
- form.setFields(errors)
- return
- } else {
- form.setFields([{ name: NON_FIELD_ERROR_NAME, errors: [ClientSideErrorMsg] }])
- throw err // unknown error, rethrow it (**)
- }
- }
- form.setFields([{ name: NON_FIELD_ERROR_NAME, errors: [] }])
- setIsLoading(true)
-
- const actionOrMutationProps = (!action) ?
- { mutation: create, variables: { data: { ...data, ...mutationExtraData }, ...mutationExtraVariables } } :
- { action: () => action({ ...data }) }
-
- return runMutation({
- ...actionOrMutationProps,
- onCompleted: () => {
- if (onMutationCompleted) onMutationCompleted()
- form.resetFields()
- },
- onFinally: () => {
- setIsLoading(false)
- cancelModal()
- },
- intl,
- form,
- ErrorToFormFieldMsgMapping,
- OnErrorMsg,
- OnCompletedMsg,
- })
- }
-
- function handleSave () {
- form.submit()
- }
-
- function handleChangeForm (changedValues, allValues) {
- if (onFormValuesChange) onFormValuesChange(changedValues, allValues)
- }
-
- return (
{ModalCancelButtonLabelMsg || CancelMsg},
- ,
- ]}
- >
-
- {children}
-
- )
-}
-
-export {
- ValidationError,
- useCreateAndEditModalForm,
- BaseModalForm,
- CreateFormListItemButton,
- ExtraDropdownActionsMenu,
- ExpandableDescription,
-}
-
-export default FormList
diff --git a/apps/_ex02front/containers/FormTable.js b/apps/_ex02front/containers/FormTable.js
deleted file mode 100644
index e271ad40..00000000
--- a/apps/_ex02front/containers/FormTable.js
+++ /dev/null
@@ -1,203 +0,0 @@
-import React, { useContext, useEffect, useMemo, useRef, useState } from 'react'
-import { Form, Input, Table } from 'antd'
-
-const DEFAULT_ROW_CONTEXT = { editing: false }
-const RowFormContext = React.createContext()
-const RowContext = React.createContext()
-const TableContext = React.createContext()
-
-function DefaultCellWrapper ({ ...props }) {
- return
|
-}
-
-function DefaultCellInner ({ children, record, rowIndex, column }) {
- const inputRef = useRef()
- const form = useContext(RowFormContext)
- // const { editable, setRowContext } = useContext(RowContext)
- const [editing, setEditing] = useState(false)
-
- useEffect(() => {
- if (column.editable && editing && inputRef.current) {
- inputRef.current.focus()
- }
- }, [column, editing, inputRef])
-
- function toggleEdit () {
- setEditing(!editing)
- form.setFieldsValue({
- // GET
- [column.dataIndex]: record[column.dataIndex],
- })
- }
-
- async function handleEdited () {
- try {
- const values = await form.validateFields()
- if (column.onEdited) {
- column.onEdited(record, values)
- } else {
- console.warn('no column.onEdited(record, newValues) callback!', record, values)
- }
- toggleEdit()
- } catch (errInfo) {
- console.log('handleEdited() failed:', errInfo)
- }
- }
-
- if (!column.editable) return children
- if (editing) {
- return
-
-
- } else {
- return
- {children}
-
- }
-}
-
-function EditableCell ({
- record, rowIndex, column, // onCellExtraProps
- children,
- ...props
-}) {
- const { CellWrapper, CellInner } = useContext(TableContext)
-
- // console.log('EditableCell', rowIndex, record, column, children, props)
-
- let Wrapper = CellWrapper || DefaultCellWrapper
- let Inner = CellInner || DefaultCellInner
-
- if (!record || !column) {
- return
{children} | // placeholder time!
- }
-
- return
-
-
-}
-
-function DefaultRowWrapper ({ ...props }) {
- return
|
-}
-
-function DefaultRowInner ({ children, record, rowIndex }) {
- const form = useContext(RowFormContext)
- return
-}
-
-function EditableRow ({
- record, rowIndex, // onRowExtraProps
- children,
- ...props
-}) {
- // Base logic: provide `rowForm` and `rowContext`
- const { RowWrapper, RowInner, rowContextInitialState } = useContext(TableContext)
- const [form] = Form.useForm()
- const [rowContext, setRowContext] = useState(rowContextInitialState || DEFAULT_ROW_CONTEXT)
- const context = useMemo(() => ({
- ...rowContextInitialState || DEFAULT_ROW_CONTEXT,
- ...rowContext,
- setRowContext,
- }), [rowContext])
-
- // console.log('EditableRow', rowIndex, record, children, props)
-
- let Wrapper = RowWrapper || DefaultRowWrapper
- let Inner = RowInner || DefaultRowInner
-
- if (!record) {
- return
{children}
// placeholder time!
- }
-
- return (
-
-
-
-
-
-
-
- )
-}
-
-function EditableBody (props) {
- // console.log('EditableBody', props)
- return
-}
-
-const TABLE_COMPONENTS = {
- body: {
- wrapper: EditableBody,
- row: EditableRow,
- cell: EditableCell,
- },
-}
-
-function _addExtraCellProps (columns) {
- // add: record, rowIndex, column
- return columns
- .map(column => {
- return {
- ...column,
- // Set props on per cell
- onCell: (record, rowIndex) => {
- const baseOnCell = (column.onCell) ? column.onCell(record, rowIndex) : {}
- return {
- ...baseOnCell,
- record,
- column,
- rowIndex,
- }
- },
- }
- })
-}
-
-function _addExtraRowProps (columns, onRow = null) {
- // add: record, rowIndex
- return (record, rowIndex) => {
- const baseOnRow = (onRow) ? onRow(record, rowIndex) : {}
- return {
- ...baseOnRow,
- record,
- rowIndex,
- }
- }
-}
-
-function FormTable ({ columns, dataSource, pagination, onChangeFilterPaginationSort, rowContextInitialState, tableContextInitialState, RowInner, CellInner }) {
- // Each row has RowContext and RowFormContext!
- if (!columns) throw new Error('columns prop is required')
-
- const fixedColumns = useMemo(() => _addExtraCellProps(columns), [columns])
- const fixedOnRow = useMemo(() => _addExtraRowProps(columns), [columns])
-
- // TODO(pahaz): add CellWrapper, RowWrapper if you know any use case?!
- return
-
-
-}
-
-FormTable.TableContext = TableContext
-FormTable.RowFormContext = RowFormContext
-FormTable.RowContext = RowContext
-export default FormTable
diff --git a/apps/_ex02front/containers/FormTableBlocks.js b/apps/_ex02front/containers/FormTableBlocks.js
deleted file mode 100644
index 7e859b7e..00000000
--- a/apps/_ex02front/containers/FormTableBlocks.js
+++ /dev/null
@@ -1,313 +0,0 @@
-import React, { useContext, useEffect } from 'react'
-import { Button, Form, Input, Space } from 'antd'
-import { useIntl } from '@core/next/intl'
-import ExcelExporterButton from './FormTableExcelImport'
-import { CreateFormListItemButton, ExtraDropdownActionsMenu } from './FormList'
-import FormTable from './FormTable'
-import { useAuth } from '@core/next/auth'
-import { useImmerReducer } from 'use-immer'
-import { DeleteOutlined, QuestionCircleOutlined, SaveOutlined } from '@ant-design/icons'
-
-const _USE_TABLE_INITIAL_STATE = {
- actions: {}, // { Create: ({values, item, form, ...}) => { ... }
- // forms: {},
- data: [],
- loading: false,
- pagination: {
- total: undefined,
- current: 1,
- pageSize: 20,
- },
- filters: {},
- sorter: {},
-}
-
-function createNewGQLItem () {
- return {
- id: Math.random(),
- isUnsavedNew: true,
- }
-}
-
-function _tableStateReducer (draft, action) {
- switch (action.type) {
- case 'reset': {
- return _USE_TABLE_INITIAL_STATE
- }
- case 'set': {
- const { key, value } = action
- draft[key] = value
- return undefined
- }
- case 'merge': {
- const { key, value } = action
- draft[key] = { ...draft[key], ...value }
- return undefined
- }
- case 'remove': {
- const { where } = action
- const keys = Object.keys(where)
- const indexes = []
- draft.data.forEach((x, index) => {
- if (keys.every((k) => x[k] === where[k])) {
- indexes.push(index)
- }
- })
- indexes.reverse()
- for (let index of indexes) {
- draft.data.splice(index, 1)
- }
- return undefined
- }
- case 'query': {
- const { pagination, filters, sorter } = action
- if (pagination) draft['pagination'] = { ...draft['pagination'], ...pagination }
- if (filters) draft['filters'] = { ...draft['filters'], ...filters }
- if (sorter) draft['sorter'] = { ...draft['sorter'], ...sorter }
- return undefined
- }
- }
-}
-
-function useTable () {
- const [state, dispatch] = useImmerReducer(_tableStateReducer, _USE_TABLE_INITIAL_STATE)
-
- return {
- state,
- setData: (value) => dispatch({ type: 'set', key: 'data', value }),
- updateFilterPaginationSort: (pagination, filters, sorter) => dispatch({
- type: 'query',
- pagination,
- filters,
- sorter,
- }),
- updateActions: (value) => dispatch({ type: 'merge', key: 'actions', value }),
- action: (name, args) => state.actions[name](args),
- reset: () => dispatch({ type: 'reset' }),
- remove: (where) => dispatch({ type: 'remove', where }),
- }
-}
-
-function _useTableRowForm () {
- const form = useContext(FormTable.RowFormContext)
- const { table } = useContext(FormTable.TableContext)
- const { editing, loading, hidden, setRowContext } = useContext(FormTable.RowContext)
-
- function setEditing (value) {
- return setRowContext(x => ({ ...x, editing: value }))
- }
-
- function setLoading (value) {
- return setRowContext(x => ({ ...x, loading: value }))
- }
-
- function setHidden (value) {
- return setRowContext(x => ({ ...x, hidden: value }))
- }
-
- function action (name, args) {
- table.action(name, args)
- }
-
- function remove (where) {
- table.remove(where)
- }
-
- return {
- action, remove,
- form, editing, loading, hidden,
- setEditing,
- setLoading,
- setHidden,
- }
-}
-
-function RenderActionsColumn (text, item, index) {
- const { user } = useAuth()
-
- const intl = useIntl()
- const AreYouSureMsg = intl.formatMessage({ id: 'AreYouSure' })
- const DeleteMsg = intl.formatMessage({ id: 'Delete' })
- const EditMsg = intl.formatMessage({ id: 'Edit' })
-
- const { isUnsavedNew } = item
- const { action, remove, form, setEditing, setLoading, editing, loading } = _useTableRowForm()
-
- function validateFields () {
- setLoading(true)
- return form.validateFields()
- .then((values) => action('CreateOrUpdate', { values, item, form }))
- .then(() => (isUnsavedNew) ? remove({ id: item.id }) : null)
- .then(() => (isUnsavedNew) ? null : setEditing(false))
- .finally(() => setLoading(false))
- }
-
- function deleteRow () {
- setLoading(false)
- setEditing(false)
- remove({ id: item.id })
- }
-
- return
- {(isUnsavedNew || editing) ?
-
- : null}
- {(isUnsavedNew) ?
-
- :
- ,
- },
- label: DeleteMsg,
- action: () => action('Delete', { values: { id: item.id }, item, form }),
- },
- {
- label: EditMsg,
- action: () => {
- setEditing(true)
- },
- },
- ]}/>
- }
-
-}
-
-function toGQLSortBy (sorter) {
- if (sorter) {
- let { field, order } = sorter
- if (field && order) {
- order = order.toLowerCase()
- if (order === 'asc' || order === 'ascend') order = 'ASC'
- else order = 'DESC'
- return `${field}_${order}`
- }
- }
- return undefined
-}
-
-function toGQLWhere (filters) {
- const where = {}
- Object.keys(filters).forEach((key) => {
- const v = filters[key]
- if (v && v.length === 1) {
- Object.assign(where, JSON.parse(v[0]))
- } else if (v && v.length >= 1) {
- if (where.OR) {
- // TODO(pahaz): it looks a problem in case of multiple OR
- throw new Error('Multiple OR query! Does not support!')
- }
- Object.assign(where, { OR: v.map(JSON.parse) })
- }
- })
- return where
-}
-
-function TableCellInner ({ children, record, rowIndex, column }) {
- const { editable, dataIndex, rules, normalize, editableInput } = column
- const { form, editing } = _useTableRowForm()
-
- const intl = useIntl()
- const FieldIsRequiredMsg = intl.formatMessage({ id: 'FieldIsRequired' })
-
- useEffect(() => {
- form.setFieldsValue({
- // TODO(pahaz): think about normalize!
- [dataIndex]: (normalize) ? normalize(record[dataIndex]) : record[dataIndex],
- })
- }, [])
-
- if (!editable || !editing) return children
- const input = (editableInput) ? editableInput() :
-
- return
- {input}
-
-}
-
-function NewOrExportTableBlock ({ columns, table }) {
- // createNewGQLItem, renderItem
- const data = table.state.data
- const setData = table.setData
-
- const intl = useIntl()
- const CreateMsg = intl.formatMessage({ id: 'Create' })
-
- function handleSetExportData (data) {
- setData(data.map(x => {
- return { ...createNewGQLItem(), ...x }
- }))
- }
-
- function handleAdd () {
- setData([...data, createNewGQLItem()])
- }
-
- // function handleSaveAll () {
- // console.log('TODO ... as child extra actions')
- // }
-
- // console.log('RERDER! NewOrExportTableBlock', columns)
-
- return <>
-
x.importFromFile))} setExportedData={handleSetExportData}/>
-
- {(data.length) ?
-
- {/**/}
- x.create))}
- CellInner={TableCellInner}
- rowContextInitialState={{ editing: true, loading: false }}
- tableContextInitialState={{ table }}
- />
-
- : null}
- >
-}
-
-function ViewOrEditTableBlock ({ columns, table }) {
- const data = table.state.data
- const pagination = table.state.pagination
- const onChangeFilterPaginationSort = table.updateFilterPaginationSort
- return
-}
-
-export {
- useTable,
- RenderActionsColumn,
- toGQLSortBy,
- toGQLWhere,
- NewOrExportTableBlock,
- ViewOrEditTableBlock,
-}
diff --git a/apps/_ex02front/containers/FormTableExcelImport.js b/apps/_ex02front/containers/FormTableExcelImport.js
deleted file mode 100644
index f39f3148..00000000
--- a/apps/_ex02front/containers/FormTableExcelImport.js
+++ /dev/null
@@ -1,257 +0,0 @@
-import React, { useEffect, useState } from 'react'
-import XLSX from 'xlsx'
-import { Button, Col, Form, Input, Progress, Row, Select, Table, Tooltip, Typography, Upload } from 'antd'
-import { InboxOutlined } from '@ant-design/icons'
-import { defaultValidator, fromExData, reValidateExData, toExData } from '../utils/excel.utils'
-import { useIntl } from '@core/next/intl'
-import { useImmer } from 'use-immer'
-import styled from '@emotion/styled'
-import { CreateFormListItemButton } from './FormList'
-
-const SHEET_JS_ACCEPT_FILES = [
- 'xlsx', 'xlsb', 'xlsm', 'xls', 'xml', 'csv', 'txt',
- 'ods', 'fods', 'uos', 'sylk', 'dif', 'dbf', 'prn',
- 'qpw', '123', 'wb*', 'wq*', 'html', 'htm',
-].map(function (x) { return '.' + x }).join(',')
-
-const ErrorText = styled.div`
- word-break: break-word;
- background: red;
-`
-
-const OkText = styled.div`
- word-break: break-word;
- background: green;
-`
-
-const WarnText = styled.div`
- word-break: break-word;
- background: yellow;
-`
-
-function MappingForm ({ columns, cols, onChangeMapping, onFinish }) {
- const [form] = Form.useForm()
- const [values, setValues] = useState({})
-
- const intl = useIntl()
- const ColumnMsg = intl.formatMessage({ id: 'containers.FormTableExcelImport.Column' })
- const SelectColumnMsg = intl.formatMessage({ id: 'containers.FormTableExcelImport.SelectColumn' })
- const NextStepButtonLabelMsg = intl.formatMessage({ id: 'containers.FormTableExcelImport.NextStepButtonLabel' })
-
- function handleChanges (changedValues, allValues) {
- const titleToIndex = Object.fromEntries(cols.map((col) => [col.title, col.dataIndex]))
- const remapped = Object.fromEntries(
- Object.entries(allValues)
- .filter(([k, v]) => v)
- .map(([k, v]) => [titleToIndex[v], k]),
- )
- setValues(allValues)
- onChangeMapping(remapped)
- }
-
- {/* disable chrome autofill hack 2 */}
- useEffect(() => {
- document.querySelectorAll('.ant-select-selector input').forEach((e) => {
- e.setAttribute('autocomplete', `stopDamnAutocomplete${Math.random()}`)
- })
- })
-
- const selectColumnComponent = (
-
- )
-
- return
-
-
- {columns.map((column, index) => {
- return
- {selectColumnComponent}
-
- })}
-
-
-
-
-}
-
-function ExcelExporterButton ({ columns, setExportedData }) {
- if (!columns) throw new Error('no columns prop')
-
- const [step, setStep] = useState(-1)
- const [tableState, setTableState] = useImmer({ data: [], cols: [], mapping: {} })
- const validators = Object.fromEntries(columns.map(column => [column.dataIndex, column.importValidator || defaultValidator]))
-
- const intl = useIntl()
- const ImportFromFileButtonLabelMsg = intl.formatMessage({ id: 'containers.FormTableExcelImport.ImportFromFileButtonLabel' })
- const ClickOrDragImportFileTextMsg = intl.formatMessage({ id: 'containers.FormTableExcelImport.ClickOrDragImportFileText' })
- const ClickOrDragImportFileHintMsg = intl.formatMessage({ id: 'containers.FormTableExcelImport.ClickOrDragImportFileHint' })
- const Step1TextMsg = intl.formatMessage({ id: 'containers.FormTableExcelImport.Step1Text' })
- const Step2TextMsg = intl.formatMessage({ id: 'containers.FormTableExcelImport.Step2Text' })
- const Step3TextMsg = intl.formatMessage({ id: 'containers.FormTableExcelImport.Step3Text' })
- const StepHelpText = {
- 1: Step1TextMsg,
- 2: Step2TextMsg,
- 3: Step3TextMsg,
- }
-
- function handleFile (file/*:File*/) {
- /* Boilerplate to set up FileReader */
- const reader = new FileReader()
- const rABS = !!reader.readAsBinaryString
- reader.onload = (e) => {
- /* Parse data */
- const bstr = e.target.result
- const wb = XLSX.read(bstr, { type: rABS ? 'binary' : 'array' })
- /* Get first worksheet */
- const wsname = wb.SheetNames[0]
- const ws = wb.Sheets[wsname]
- /* Convert array of arrays */
- const cols = makeAntdCols(ws['!ref'], { render: renderCell })
- const data = makeAntdData(ws)
- setStep(2)
- setTableState((draft) => {
- draft.cols = cols
- draft.data = data
- })
- }
- if (rABS) {
- reader.readAsBinaryString(file)
- } else {
- reader.readAsArrayBuffer(file)
- }
- }
-
- function handleChangeMapping (mapping) {
- setTableState(draft => {
- console.log('reValidateExData', tableState.mapping, mapping, validators)
- reValidateExData(draft.data, draft.mapping, mapping, validators)
- draft.mapping = mapping
- })
- }
-
- function handleFinish () {
- setStep(step + 1)
- setExportedData(fromExData(tableState.data, tableState.mapping))
- }
-
- return <>
- setStep(1)} label={ImportFromFileButtonLabelMsg}
- style={{ marginBottom: '16px', width: '100%', display: step === -1 ? 'block' : 'none' }}/>
- {(step > 0) ?
-