From 14945a2c5d510652648086b70d9103e870af8609 Mon Sep 17 00:00:00 2001 From: pahaz Date: Sat, 11 May 2024 14:06:20 +0300 Subject: [PATCH 1/7] chore: cleanup and start from scratch --- .dockerignore | 2 + .env.example | 17 +- .eslintignore | 14 - .github/workflows/ci.build.yml | 27 + .github/workflows/ci.docker.yml | 17 + .github/workflows/ci.linters.yml | 27 + .github/workflows/nodejs.apps.demo.yml | 53 -- .github/workflows/nodejs.apps.front.yml | 32 - .github/workflows/nodejs.codestyle.yml | 25 - .github/workflows/nodejs.demo.deploy.yml | 44 -- .gitignore | 88 ++- Dockerfile | 26 +- README.md | 49 +- apps/README.md | 4 + apps/_demo/README.md | 5 - apps/_demo/babel.config.js | 6 - apps/_demo/e2e_tests/health.test.js | 22 - apps/_demo/index.js | 74 -- apps/_demo/initialData.js | 33 - apps/_demo/jest.config.js | 20 - apps/_demo/jest.setup.js | 5 - apps/_demo/lang/en.json | 6 - apps/_demo/lang/ru.json | 6 - .../migrations/20200529191915-0001_initial.js | 89 --- ...0002_chatmessage_condo_condo_users_many.js | 50 -- .../20200530002440-0003_auto_20200529_1924.js | 50 -- .../20200530002952-0004_auto_20200529_1929.js | 26 - .../20200530003042-0005_auto_20200529_1930.js | 29 - ...006_organization_organizationtouserlink.js | 46 -- .../20200602193546-0007_user_phone.js | 27 - .../20200604160737-0008_auto_20200604_1107.js | 34 - .../20200604214642-0009_auto_20200604_1646.js | 28 - .../20200605011137-0010_auto_20200604_2012.js | 31 - .../20200605012057-0011_auto_20200604_2021.js | 38 - .../20200605171927-0012_test_related_many.js | 30 - ...03032-0013_remove_organization_isactive.js | 26 - .../20200610013950-0014_auto_20200609_2040.js | 36 - .../20200610021618-0015_auto_20200609_2116.js | 34 - .../20200627150216-0016_auto_20200627_1002.js | 58 -- .../20200627153246-0017_auto_20200627_1032.js | 30 - .../20200706171722-0018_user_meta.js | 26 - .../20200729131257-0019_auto_20200729_1013.js | 81 --- .../20200822020912-0020_user_importid.js | 26 - .../20201016113521-0021_auto_20201016_0835.js | 36 - .../20201105140205-0022_auto_20201105_1102.js | 77 -- .../20201105140724-0023_auto_20201105_1107.js | 42 -- .../20201105141545-0024_test_text.js | 26 - .../20201106233317-0025_auto_20201106_2033.js | 66 -- .../20201107004556-0026_auto_20201106_2145.js | 91 --- .../20201107115450-0027_auto_20201107_0854.js | 70 -- .../20201108125508-0028_auto_20201108_0955.js | 112 --- .../20201108185916-0029_auto_20201108_1559.js | 34 - .../20201109003437-0030_auto_20201108_2134.js | 116 --- .../20201109010114-0031_auto_20201108_2201.js | 48 -- ...testhistoryrecord_testitemhistoryrecord.js | 48 -- .../20201109010711-0033_auto_20201108_2207.js | 78 --- .../20201110002813-0034_auto_20201109_2128.js | 77 -- .../20201110122058-0035_auto_20201110_0920.js | 35 - .../20201113124047-0036_auto_20201113_0941.js | 162 ----- ...etedobj_testsoftdeletedobjhistoryrecord.js | 38 - .../20201114162752-0038_auto_20201114_1327.js | 26 - .../20201114170851-0039_auto_20201114_1408.js | 25 - .../20201114181941-0040_auto_20201114_1519.js | 39 -- .../20201114191744-0041_auto_20201114_1617.js | 34 - ...1124164415-0042_testautoincrementnumber.js | 26 - .../20210204005245-0043_auto_20210203_2152.js | 188 ----- .../20210204103435-0044_auto_20210204_0734.js | 34 - apps/_demo/next.config.js | 23 - apps/_demo/package.json | 69 -- apps/_demo/pages/_app.jsx | 83 --- apps/_demo/pages/_document.js | 27 - apps/_demo/pages/auth/register.jsx | 301 -------- apps/_demo/pages/auth/signin.jsx | 158 ----- apps/_demo/pages/index.jsx | 31 - apps/_demo/pages/organizations.jsx | 2 - apps/_demo/pages/users.jsx | 2 - apps/_demo/public/favicon.ico | Bin 33036 -> 0 bytes apps/_demo/public/logo.svg | 11 - apps/_demo/schema/Auth.js | 76 -- apps/_demo/schema/Organization.js | 71 -- apps/_demo/schema/Organization.test.js | 660 ------------------ apps/_demo/schema/Test.js | 183 ----- apps/_demo/schema/Test.test.js | 420 ----------- apps/_demo/schema/User.js | 124 ---- apps/_demo/schema/User.test.js | 521 -------------- apps/_demo/utils/firebase.back.utils.js | 16 - apps/_demo/utils/firebase.front.utils.js | 25 - apps/_ex01back/index.js | 53 -- apps/_ex01back/initialData.js | 29 - .../migrations/20210203205359-0001_initial.js | 31 - apps/_ex01back/package.json | 36 - apps/_ex01back/schema/User.js | 12 - apps/_ex01front/package.json | 14 - apps/_ex01front/pages/index.jsx | 5 - apps/_ex01mobile/App.js | 18 - apps/_ex01mobile/AppNavigator.js | 21 - apps/_ex01mobile/app.json | 26 - apps/_ex01mobile/assets/favicon.png | Bin 1466 -> 0 bytes apps/_ex01mobile/assets/icon.png | Bin 642 -> 0 bytes apps/_ex01mobile/assets/splash.png | Bin 9306 -> 0 bytes apps/_ex01mobile/babel.config.js | 6 - apps/_ex01mobile/context/theme.js | 24 - apps/_ex01mobile/metro.config.js | 3 - apps/_ex01mobile/package.json | 42 -- apps/_ex01mobile/screens/details.screen.js | 38 - apps/_ex01mobile/screens/index.screen.js | 44 -- apps/_ex02back/index.js | 61 -- apps/_ex02back/initialData.js | 29 - .../migrations/20210203214827-0001_initial.js | 73 -- .../20210204185931-0002_auto_20210204_1559.js | 57 -- apps/_ex02back/multi-app-support.js | 18 - apps/_ex02back/package.json | 39 -- apps/_ex02back/schema/Organization.js | 68 -- apps/_ex02back/schema/User.js | 26 - apps/_ex02front/babel.config.js | 6 - apps/_ex02front/containers/AuthRequired.js | 54 -- .../containers/BaseLayout/BaseLayout.jsx | 287 -------- .../BaseLayout/TopMenuOnlyLayout.jsx | 17 - .../containers/BaseLayout/antd-custom.less | 11 - .../BaseLayout/components/TopMenuItems.jsx | 143 ---- .../_ex02front/containers/BaseLayout/index.js | 9 - apps/_ex02front/containers/Chat.jsx | 240 ------- apps/_ex02front/containers/FormBlocks.js | 51 -- apps/_ex02front/containers/FormList.js | 330 --------- apps/_ex02front/containers/FormTable.js | 203 ------ apps/_ex02front/containers/FormTableBlocks.js | 313 --------- .../containers/FormTableExcelImport.js | 257 ------- .../containers/GlobalErrorBoundery.js | 30 - apps/_ex02front/containers/GlobalStyle.js | 452 ------------ apps/_ex02front/containers/GoogleAnalytics.js | 24 - .../containers/OrganizationRequired.js | 63 -- apps/_ex02front/jest.config.js | 17 - apps/_ex02front/jest.setup.js | 5 - apps/_ex02front/lang/en.json | 118 ---- apps/_ex02front/lang/ru.json | 118 ---- apps/_ex02front/multi-app-support.js | 18 - apps/_ex02front/next.config.js | 19 - apps/_ex02front/package.json | 47 -- apps/_ex02front/pages/_app.jsx | 100 --- apps/_ex02front/pages/_document.jsx | 28 - .../_ex02front/pages/auth/change-password.jsx | 146 ---- apps/_ex02front/pages/auth/forgot.jsx | 112 --- apps/_ex02front/pages/auth/register.jsx | 215 ------ apps/_ex02front/pages/auth/signin.jsx | 117 ---- apps/_ex02front/pages/index.jsx | 27 - apps/_ex02front/pages/organizations.jsx | 260 ------- apps/_ex02front/pages/users.jsx | 328 --------- apps/_ex02front/public/favicon.ico | Bin 33036 -> 0 bytes apps/_ex02front/public/logo.svg | 11 - apps/_ex02front/utils/ecmascript.utils.js | 17 - .../_ex02front/utils/ecmascript.utils.spec.js | 44 -- apps/_ex02front/utils/excel.utils.js | 284 -------- apps/_ex02front/utils/excel.utils.spec.js | 159 ----- apps/_ex02front/utils/mediaQuery.utils.js | 95 --- .../_ex02front/utils/mediaQuery.utils.spec.js | 5 - apps/_ex02front/utils/mutations.utils.js | 91 --- apps/_ex02front/utils/url.utils.js | 14 - apps/_ex02front/utils/url.utils.spec.js | 23 - apps/_ex02sockio/index.js | 18 - apps/_ex02sockio/multi-app-support.js | 26 - apps/_ex02sockio/package.json | 20 - apps/_ex02sockio/server.js | 15 - apps/_ex02sockio/test.html | 38 - bin/createapp | 4 - bin/kmigrator.py | 646 ----------------- bin/run-build-all | 65 -- bin/run-multiple-apps | 48 -- bin/warm-docker-cache | 12 - docker-compose.yml | 38 +- docs/FAQ.md | 31 - docs/contributing.md | 169 ++--- docs/deploy.md | 82 +-- docs/getting-started-adv.md | 247 ------- docs/getting-started.md | 11 +- docs/gists.md | 139 ---- docs/index.md | 11 - docs/links.md | 5 +- package.json | 88 +-- packages/@core.codegen/index.js | 109 --- packages/@core.codegen/package.json | 12 - .../@core.codegen/templates/app00/README.md | 50 -- .../templates/app00/babel.config.js | 6 - .../@core.codegen/templates/app00/index.js | 63 -- .../templates/app00/initialData.js | 29 - .../templates/app00/jest.config.js | 20 - .../templates/app00/jest.setup.js | 5 - .../templates/app00/lang/en.json | 6 - .../templates/app00/lang/ru.json | 6 - .../templates/app00/next.config.js | 20 - .../templates/app00/package.json | 68 -- .../templates/app00/pages/_app.jsx | 83 --- .../templates/app00/pages/_document.js | 27 - .../app00/pages/auth/change-password.jsx | 2 - .../templates/app00/pages/auth/forgot.jsx | 2 - .../templates/app00/pages/auth/register.jsx | 2 - .../templates/app00/pages/auth/signin.jsx | 2 - .../templates/app00/pages/index.jsx | 31 - .../templates/app00/pages/organizations.jsx | 2 - .../templates/app00/pages/users.jsx | 2 - .../templates/app00/public/favicon.ico | Bin 33036 -> 0 bytes .../templates/app00/public/logo.svg | 11 - .../templates/app00/schema/Organization.js | 1 - .../templates/app00/schema/User.js | 1 - packages/@core.config/README.md | 8 - packages/@core.config/index.js | 80 --- packages/@core.config/package.json | 8 - packages/@core.keystone/README.md | 4 - packages/@core.keystone/access.js | 66 -- packages/@core.keystone/access.spec.js | 32 - .../AutoIncrementInteger/Implementation.js | 51 -- .../fields/AutoIncrementInteger/index.js | 12 - .../fields/Json/Implementation.js | 145 ---- packages/@core.keystone/fields/Json/index.js | 12 - .../fields/Options/Implementation.js | 152 ---- .../@core.keystone/fields/Options/index.js | 18 - .../fields/Options/views/Cell.js | 15 - .../fields/Options/views/Controller.js | 39 -- .../fields/Options/views/Field.js | 78 --- .../fields/Stars/Implementation.js | 13 - packages/@core.keystone/fields/Stars/index.js | 20 - .../@core.keystone/fields/Stars/views/Cell.js | 9 - .../fields/Stars/views/Field.js | 15 - .../fields/Stars/views/Stars.js | 39 -- .../fields/Stars/views/star-empty.js | 19 - .../fields/Stars/views/star-full.js | 19 - packages/@core.keystone/fields/index.js | 11 - .../@core.keystone/gen.gql.react.utils.js | 94 --- packages/@core.keystone/gen.gql.utils.js | 136 ---- packages/@core.keystone/package.json | 36 - packages/@core.keystone/plugins/historical.js | 199 ------ packages/@core.keystone/plugins/index.js | 13 - .../@core.keystone/plugins/softDeleted.js | 118 ---- packages/@core.keystone/plugins/tracked.js | 90 --- .../plugins/utils/HiddenRelationship.js | 74 -- .../@core.keystone/plugins/utils/index.js | 19 - packages/@core.keystone/plugins/uuided.js | 18 - packages/@core.keystone/plugins/versioned.js | 34 - packages/@core.keystone/schema.js | 190 ----- packages/@core.keystone/schema.spec.js | 147 ---- .../@core.keystone/schemas/Organization.js | 538 -------------- packages/@core.keystone/schemas/User.js | 442 ------------ packages/@core.keystone/setup.utils.js | 74 -- packages/@core.keystone/setup.utils.spec.js | 37 - packages/@core.keystone/test.utils.js | 348 --------- packages/@core.next/README.md | 108 --- packages/@core.next/_utils.js | 44 -- packages/@core.next/apollo.jsx | 224 ------ packages/@core.next/auth.jsx | 204 ------ packages/@core.next/intl.jsx | 147 ---- packages/@core.next/lang/en.json | 1 - packages/@core.next/organization.jsx | 205 ------ packages/@core.next/package.json | 14 - packages/README.md | 4 + 253 files changed, 270 insertions(+), 17835 deletions(-) delete mode 100644 .eslintignore create mode 100644 .github/workflows/ci.build.yml create mode 100644 .github/workflows/ci.docker.yml create mode 100644 .github/workflows/ci.linters.yml delete mode 100644 .github/workflows/nodejs.apps.demo.yml delete mode 100644 .github/workflows/nodejs.apps.front.yml delete mode 100644 .github/workflows/nodejs.codestyle.yml delete mode 100644 .github/workflows/nodejs.demo.deploy.yml create mode 100644 apps/README.md delete mode 100644 apps/_demo/README.md delete mode 100644 apps/_demo/babel.config.js delete mode 100644 apps/_demo/e2e_tests/health.test.js delete mode 100644 apps/_demo/index.js delete mode 100644 apps/_demo/initialData.js delete mode 100644 apps/_demo/jest.config.js delete mode 100644 apps/_demo/jest.setup.js delete mode 100644 apps/_demo/lang/en.json delete mode 100644 apps/_demo/lang/ru.json delete mode 100644 apps/_demo/migrations/20200529191915-0001_initial.js delete mode 100644 apps/_demo/migrations/20200529191932-0002_chatmessage_condo_condo_users_many.js delete mode 100644 apps/_demo/migrations/20200530002440-0003_auto_20200529_1924.js delete mode 100644 apps/_demo/migrations/20200530002952-0004_auto_20200529_1929.js delete mode 100644 apps/_demo/migrations/20200530003042-0005_auto_20200529_1930.js delete mode 100644 apps/_demo/migrations/20200602162923-0006_organization_organizationtouserlink.js delete mode 100644 apps/_demo/migrations/20200602193546-0007_user_phone.js delete mode 100644 apps/_demo/migrations/20200604160737-0008_auto_20200604_1107.js delete mode 100644 apps/_demo/migrations/20200604214642-0009_auto_20200604_1646.js delete mode 100644 apps/_demo/migrations/20200605011137-0010_auto_20200604_2012.js delete mode 100644 apps/_demo/migrations/20200605012057-0011_auto_20200604_2021.js delete mode 100644 apps/_demo/migrations/20200605171927-0012_test_related_many.js delete mode 100644 apps/_demo/migrations/20200610003032-0013_remove_organization_isactive.js delete mode 100644 apps/_demo/migrations/20200610013950-0014_auto_20200609_2040.js delete mode 100644 apps/_demo/migrations/20200610021618-0015_auto_20200609_2116.js delete mode 100644 apps/_demo/migrations/20200627150216-0016_auto_20200627_1002.js delete mode 100644 apps/_demo/migrations/20200627153246-0017_auto_20200627_1032.js delete mode 100644 apps/_demo/migrations/20200706171722-0018_user_meta.js delete mode 100644 apps/_demo/migrations/20200729131257-0019_auto_20200729_1013.js delete mode 100644 apps/_demo/migrations/20200822020912-0020_user_importid.js delete mode 100644 apps/_demo/migrations/20201016113521-0021_auto_20201016_0835.js delete mode 100644 apps/_demo/migrations/20201105140205-0022_auto_20201105_1102.js delete mode 100644 apps/_demo/migrations/20201105140724-0023_auto_20201105_1107.js delete mode 100644 apps/_demo/migrations/20201105141545-0024_test_text.js delete mode 100644 apps/_demo/migrations/20201106233317-0025_auto_20201106_2033.js delete mode 100644 apps/_demo/migrations/20201107004556-0026_auto_20201106_2145.js delete mode 100644 apps/_demo/migrations/20201107115450-0027_auto_20201107_0854.js delete mode 100644 apps/_demo/migrations/20201108125508-0028_auto_20201108_0955.js delete mode 100644 apps/_demo/migrations/20201108185916-0029_auto_20201108_1559.js delete mode 100644 apps/_demo/migrations/20201109003437-0030_auto_20201108_2134.js delete mode 100644 apps/_demo/migrations/20201109010114-0031_auto_20201108_2201.js delete mode 100644 apps/_demo/migrations/20201109010208-0032_testhistoryrecord_testitemhistoryrecord.js delete mode 100644 apps/_demo/migrations/20201109010711-0033_auto_20201108_2207.js delete mode 100644 apps/_demo/migrations/20201110002813-0034_auto_20201109_2128.js delete mode 100644 apps/_demo/migrations/20201110122058-0035_auto_20201110_0920.js delete mode 100644 apps/_demo/migrations/20201113124047-0036_auto_20201113_0941.js delete mode 100644 apps/_demo/migrations/20201114151635-0037_testsoftdeletedobj_testsoftdeletedobjhistoryrecord.js delete mode 100644 apps/_demo/migrations/20201114162752-0038_auto_20201114_1327.js delete mode 100644 apps/_demo/migrations/20201114170851-0039_auto_20201114_1408.js delete mode 100644 apps/_demo/migrations/20201114181941-0040_auto_20201114_1519.js delete mode 100644 apps/_demo/migrations/20201114191744-0041_auto_20201114_1617.js delete mode 100644 apps/_demo/migrations/20201124164415-0042_testautoincrementnumber.js delete mode 100644 apps/_demo/migrations/20210204005245-0043_auto_20210203_2152.js delete mode 100644 apps/_demo/migrations/20210204103435-0044_auto_20210204_0734.js delete mode 100644 apps/_demo/next.config.js delete mode 100644 apps/_demo/package.json delete mode 100644 apps/_demo/pages/_app.jsx delete mode 100644 apps/_demo/pages/_document.js delete mode 100644 apps/_demo/pages/auth/register.jsx delete mode 100644 apps/_demo/pages/auth/signin.jsx delete mode 100644 apps/_demo/pages/index.jsx delete mode 100644 apps/_demo/pages/organizations.jsx delete mode 100644 apps/_demo/pages/users.jsx delete mode 100644 apps/_demo/public/favicon.ico delete mode 100644 apps/_demo/public/logo.svg delete mode 100644 apps/_demo/schema/Auth.js delete mode 100644 apps/_demo/schema/Organization.js delete mode 100644 apps/_demo/schema/Organization.test.js delete mode 100644 apps/_demo/schema/Test.js delete mode 100644 apps/_demo/schema/Test.test.js delete mode 100644 apps/_demo/schema/User.js delete mode 100644 apps/_demo/schema/User.test.js delete mode 100644 apps/_demo/utils/firebase.back.utils.js delete mode 100644 apps/_demo/utils/firebase.front.utils.js delete mode 100644 apps/_ex01back/index.js delete mode 100644 apps/_ex01back/initialData.js delete mode 100644 apps/_ex01back/migrations/20210203205359-0001_initial.js delete mode 100644 apps/_ex01back/package.json delete mode 100644 apps/_ex01back/schema/User.js delete mode 100644 apps/_ex01front/package.json delete mode 100644 apps/_ex01front/pages/index.jsx delete mode 100644 apps/_ex01mobile/App.js delete mode 100644 apps/_ex01mobile/AppNavigator.js delete mode 100644 apps/_ex01mobile/app.json delete mode 100644 apps/_ex01mobile/assets/favicon.png delete mode 100644 apps/_ex01mobile/assets/icon.png delete mode 100644 apps/_ex01mobile/assets/splash.png delete mode 100644 apps/_ex01mobile/babel.config.js delete mode 100644 apps/_ex01mobile/context/theme.js delete mode 100644 apps/_ex01mobile/metro.config.js delete mode 100644 apps/_ex01mobile/package.json delete mode 100644 apps/_ex01mobile/screens/details.screen.js delete mode 100644 apps/_ex01mobile/screens/index.screen.js delete mode 100644 apps/_ex02back/index.js delete mode 100644 apps/_ex02back/initialData.js delete mode 100644 apps/_ex02back/migrations/20210203214827-0001_initial.js delete mode 100644 apps/_ex02back/migrations/20210204185931-0002_auto_20210204_1559.js delete mode 100644 apps/_ex02back/multi-app-support.js delete mode 100644 apps/_ex02back/package.json delete mode 100644 apps/_ex02back/schema/Organization.js delete mode 100644 apps/_ex02back/schema/User.js delete mode 100644 apps/_ex02front/babel.config.js delete mode 100644 apps/_ex02front/containers/AuthRequired.js delete mode 100644 apps/_ex02front/containers/BaseLayout/BaseLayout.jsx delete mode 100644 apps/_ex02front/containers/BaseLayout/TopMenuOnlyLayout.jsx delete mode 100644 apps/_ex02front/containers/BaseLayout/antd-custom.less delete mode 100644 apps/_ex02front/containers/BaseLayout/components/TopMenuItems.jsx delete mode 100644 apps/_ex02front/containers/BaseLayout/index.js delete mode 100644 apps/_ex02front/containers/Chat.jsx delete mode 100644 apps/_ex02front/containers/FormBlocks.js delete mode 100644 apps/_ex02front/containers/FormList.js delete mode 100644 apps/_ex02front/containers/FormTable.js delete mode 100644 apps/_ex02front/containers/FormTableBlocks.js delete mode 100644 apps/_ex02front/containers/FormTableExcelImport.js delete mode 100644 apps/_ex02front/containers/GlobalErrorBoundery.js delete mode 100644 apps/_ex02front/containers/GlobalStyle.js delete mode 100644 apps/_ex02front/containers/GoogleAnalytics.js delete mode 100644 apps/_ex02front/containers/OrganizationRequired.js delete mode 100644 apps/_ex02front/jest.config.js delete mode 100644 apps/_ex02front/jest.setup.js delete mode 100644 apps/_ex02front/lang/en.json delete mode 100644 apps/_ex02front/lang/ru.json delete mode 100644 apps/_ex02front/multi-app-support.js delete mode 100644 apps/_ex02front/next.config.js delete mode 100644 apps/_ex02front/package.json delete mode 100644 apps/_ex02front/pages/_app.jsx delete mode 100644 apps/_ex02front/pages/_document.jsx delete mode 100644 apps/_ex02front/pages/auth/change-password.jsx delete mode 100644 apps/_ex02front/pages/auth/forgot.jsx delete mode 100644 apps/_ex02front/pages/auth/register.jsx delete mode 100644 apps/_ex02front/pages/auth/signin.jsx delete mode 100644 apps/_ex02front/pages/index.jsx delete mode 100644 apps/_ex02front/pages/organizations.jsx delete mode 100644 apps/_ex02front/pages/users.jsx delete mode 100644 apps/_ex02front/public/favicon.ico delete mode 100644 apps/_ex02front/public/logo.svg delete mode 100644 apps/_ex02front/utils/ecmascript.utils.js delete mode 100644 apps/_ex02front/utils/ecmascript.utils.spec.js delete mode 100644 apps/_ex02front/utils/excel.utils.js delete mode 100644 apps/_ex02front/utils/excel.utils.spec.js delete mode 100644 apps/_ex02front/utils/mediaQuery.utils.js delete mode 100644 apps/_ex02front/utils/mediaQuery.utils.spec.js delete mode 100644 apps/_ex02front/utils/mutations.utils.js delete mode 100644 apps/_ex02front/utils/url.utils.js delete mode 100644 apps/_ex02front/utils/url.utils.spec.js delete mode 100644 apps/_ex02sockio/index.js delete mode 100644 apps/_ex02sockio/multi-app-support.js delete mode 100644 apps/_ex02sockio/package.json delete mode 100644 apps/_ex02sockio/server.js delete mode 100644 apps/_ex02sockio/test.html delete mode 100644 bin/createapp delete mode 100755 bin/kmigrator.py delete mode 100755 bin/run-build-all delete mode 100755 bin/run-multiple-apps delete mode 100755 bin/warm-docker-cache delete mode 100644 docs/FAQ.md delete mode 100644 docs/getting-started-adv.md delete mode 100644 docs/gists.md delete mode 100644 docs/index.md delete mode 100755 packages/@core.codegen/index.js delete mode 100644 packages/@core.codegen/package.json delete mode 100644 packages/@core.codegen/templates/app00/README.md delete mode 100644 packages/@core.codegen/templates/app00/babel.config.js delete mode 100644 packages/@core.codegen/templates/app00/index.js delete mode 100644 packages/@core.codegen/templates/app00/initialData.js delete mode 100644 packages/@core.codegen/templates/app00/jest.config.js delete mode 100644 packages/@core.codegen/templates/app00/jest.setup.js delete mode 100644 packages/@core.codegen/templates/app00/lang/en.json delete mode 100644 packages/@core.codegen/templates/app00/lang/ru.json delete mode 100644 packages/@core.codegen/templates/app00/next.config.js delete mode 100644 packages/@core.codegen/templates/app00/package.json delete mode 100644 packages/@core.codegen/templates/app00/pages/_app.jsx delete mode 100644 packages/@core.codegen/templates/app00/pages/_document.js delete mode 100644 packages/@core.codegen/templates/app00/pages/auth/change-password.jsx delete mode 100644 packages/@core.codegen/templates/app00/pages/auth/forgot.jsx delete mode 100644 packages/@core.codegen/templates/app00/pages/auth/register.jsx delete mode 100644 packages/@core.codegen/templates/app00/pages/auth/signin.jsx delete mode 100644 packages/@core.codegen/templates/app00/pages/index.jsx delete mode 100644 packages/@core.codegen/templates/app00/pages/organizations.jsx delete mode 100644 packages/@core.codegen/templates/app00/pages/users.jsx delete mode 100644 packages/@core.codegen/templates/app00/public/favicon.ico delete mode 100644 packages/@core.codegen/templates/app00/public/logo.svg delete mode 100644 packages/@core.codegen/templates/app00/schema/Organization.js delete mode 100644 packages/@core.codegen/templates/app00/schema/User.js delete mode 100644 packages/@core.config/README.md delete mode 100644 packages/@core.config/index.js delete mode 100644 packages/@core.config/package.json delete mode 100644 packages/@core.keystone/README.md delete mode 100644 packages/@core.keystone/access.js delete mode 100644 packages/@core.keystone/access.spec.js delete mode 100644 packages/@core.keystone/fields/AutoIncrementInteger/Implementation.js delete mode 100644 packages/@core.keystone/fields/AutoIncrementInteger/index.js delete mode 100644 packages/@core.keystone/fields/Json/Implementation.js delete mode 100644 packages/@core.keystone/fields/Json/index.js delete mode 100644 packages/@core.keystone/fields/Options/Implementation.js delete mode 100644 packages/@core.keystone/fields/Options/index.js delete mode 100644 packages/@core.keystone/fields/Options/views/Cell.js delete mode 100644 packages/@core.keystone/fields/Options/views/Controller.js delete mode 100644 packages/@core.keystone/fields/Options/views/Field.js delete mode 100644 packages/@core.keystone/fields/Stars/Implementation.js delete mode 100644 packages/@core.keystone/fields/Stars/index.js delete mode 100644 packages/@core.keystone/fields/Stars/views/Cell.js delete mode 100644 packages/@core.keystone/fields/Stars/views/Field.js delete mode 100644 packages/@core.keystone/fields/Stars/views/Stars.js delete mode 100644 packages/@core.keystone/fields/Stars/views/star-empty.js delete mode 100644 packages/@core.keystone/fields/Stars/views/star-full.js delete mode 100644 packages/@core.keystone/fields/index.js delete mode 100644 packages/@core.keystone/gen.gql.react.utils.js delete mode 100644 packages/@core.keystone/gen.gql.utils.js delete mode 100644 packages/@core.keystone/package.json delete mode 100644 packages/@core.keystone/plugins/historical.js delete mode 100644 packages/@core.keystone/plugins/index.js delete mode 100644 packages/@core.keystone/plugins/softDeleted.js delete mode 100644 packages/@core.keystone/plugins/tracked.js delete mode 100644 packages/@core.keystone/plugins/utils/HiddenRelationship.js delete mode 100644 packages/@core.keystone/plugins/utils/index.js delete mode 100644 packages/@core.keystone/plugins/uuided.js delete mode 100644 packages/@core.keystone/plugins/versioned.js delete mode 100644 packages/@core.keystone/schema.js delete mode 100644 packages/@core.keystone/schema.spec.js delete mode 100644 packages/@core.keystone/schemas/Organization.js delete mode 100644 packages/@core.keystone/schemas/User.js delete mode 100644 packages/@core.keystone/setup.utils.js delete mode 100644 packages/@core.keystone/setup.utils.spec.js delete mode 100644 packages/@core.keystone/test.utils.js delete mode 100644 packages/@core.next/README.md delete mode 100644 packages/@core.next/_utils.js delete mode 100644 packages/@core.next/apollo.jsx delete mode 100644 packages/@core.next/auth.jsx delete mode 100644 packages/@core.next/intl.jsx delete mode 100644 packages/@core.next/lang/en.json delete mode 100644 packages/@core.next/organization.jsx delete mode 100644 packages/@core.next/package.json create mode 100644 packages/README.md diff --git a/.dockerignore b/.dockerignore index 9c7a4b47..d7d7d1b2 100644 --- a/.dockerignore +++ b/.dockerignore @@ -11,7 +11,9 @@ **/dist **/out **/.idea +**/.vscode **/.kmigrator +**/.turbo **/docs **/.config **/.yarn 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..1c763177 --- /dev/null +++ b/.github/workflows/ci.build.yml @@ -0,0 +1,27 @@ +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: yarn + - 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..a5bdc0c8 --- /dev/null +++ b/.github/workflows/ci.docker.yml @@ -0,0 +1,17 @@ +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 diff --git a/.github/workflows/ci.linters.yml b/.github/workflows/ci.linters.yml new file mode 100644 index 00000000..10cf1038 --- /dev/null +++ b/.github/workflows/ci.linters.yml @@ -0,0 +1,27 @@ +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: yarn + - name: BUILD + 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..e02d089f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,20 +1,24 @@ -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.* @@ -26,3 +30,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/Dockerfile b/Dockerfile index 48acb0ee..44e6f7b0 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,25 @@ 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 # Cache packages! RUN set -ex && yarn install 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 && \ + yarn cache clean && \ + rm -rf /home/app/.env && \ + rm -rf /home/app/.config && \ + rm -rf /home/app/.yarn && \ + rm -rf /home/app/.cache && \ ls -lah /home/app/ # Runtime container diff --git a/README.md b/README.md index cbf34360..54dafd66 100644 --- a/README.md +++ b/README.md @@ -4,42 +4,39 @@ # 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) +* [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. -This project provides you with these basic features, allowing you to focus on core business logic +If you are making a B2B solution, you need to implement roles and access rights and the possibility of invites. -Our primary focus is startup developers and hackaton teams +You need to implement notifications, page templates, and internationalization support. -## Features +Using a template, you don't have to spend hours choosing technologies and gluing them together. + +The libraries used can be changed over time. + +Don't start by choosing a technology, start implement your key features! -**VERSION**: 0.0.1 **𝛼** +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 -* Based on ApolloGraphql, KeystoneJS and NextJS * Auth flow * Registration * Authentication and Authorization @@ -48,13 +45,9 @@ Our primary focus is startup developers and hackaton teams * 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 +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..6757bac2 --- /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:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMC42IG9uIDIwMjAtMDUtMjkgMTQ6MTkKCmltcG9ydCBkamFuZ28uY29udHJpYi5wb3N0Z3Jlcy5maWVsZHMuanNvbmIKZnJvbSBkamFuZ28uZGIgaW1wb3J0IG1pZ3JhdGlvbnMsIG1vZGVscwppbXBvcnQgZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbgoKCmNsYXNzIE1pZ3JhdGlvbihtaWdyYXRpb25zLk1pZ3JhdGlvbik6CgogICAgaW5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ndGg9NTApKSwKICAgICAgICAgICAgICAgICgndXVpZCcsIG1vZGVscy5VVUlERmllbGQoKSksCiAgICAgICAgICAgICAgICAoJ3VybCcsIG1vZGVscy5UZXh0RmllbGQoKSksCiAgICAgICAgICAgICAgICAoJ3NsdWcnLCBtb2RlbHMuVGV4dEZpZWxkKHVuaXF1ZT1UcnVlKSksCiAgICAgICAgICAgICAgICAoJ3NlbGYnLCBtb2RlbHMuRm9yZWlnbktleShibGFuaz1UcnVlLCBkYl9jb2x1bW49J3NlbGYnLCBudWxsPVRydWUsIG9uX2RlbGV0ZT1kamFuZ28uZGIubW9kZWxzLmRlbGV0aW9uLkRPX05PVEhJTkcsIHJlbGF0ZWRfbmFtZT0nKycsIHRvPSdfZGphbmdvX3NjaGVtYS50ZXN0JykpLAogICAgICAgICAgICBdLAogICAgICAgICAgICBvcHRpb25zPXsKICAgICAgICAgICAgICAgICdkYl90YWJsZSc6ICdUZXN0JywKICAgICAgICAgICAgfSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQ3JlYXRlTW9kZWwoCiAgICAgICAgICAgIG5hbWU9J3VzZXInLAogICAgICAgICAgICBmaWVsZHM9WwogICAgICAgICAgICAgICAgKCdpZCcsIG1vZGVscy5BdXRvRmllbGQocHJpbWFyeV9rZXk9VHJ1ZSwgc2VyaWFsaXplPUZhbHNlKSksCiAgICAgICAgICAgICAgICAoJ25hbWUnLCBtb2RlbHMuVGV4dEZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCdlbWFpbCcsIG1vZGVscy5UZXh0RmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlLCB1bmlxdWU9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCdpc0FkbWluJywgbW9kZWxzLkJvb2xlYW5GaWVsZCgpKSwKICAgICAgICAgICAgICAgICgnaXNBY3RpdmUnLCBtb2RlbHMuQm9vbGVhbkZpZWxkKCkpLAogICAgICAgICAgIC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cnVlLCBkYl9jb2x1bW49J2NyZWF0ZWRCeScsIG51bGw9VHJ1ZSwgb25fZGVsZXRlPWRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24uRE9fTk9USElORywgcmVsYXRlZF9uYW1lPScrJywgdG89J19kamFuZ29fc2NoZW1hLnVzZXInKSksCiAgICAgICAgICAgICAgICAoJ3VwZGF0ZWRCeScsIG1vZGVscy5Gb3JlaWduS2V5KGJsYW5rPVRydWUsIGRiX2NvbHVtbj0ndXBkYXRlZEJ5JywgbnVsbD1UcnVlLCBvbl9kZWxldGU9ZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbi5ET19OT1RISU5HLCByZWxhdGVkX25hbWU9JysnLCB0bz0nX2RqYW5nb19zY2hlbWEudXNlcicpKSwKICAgICAgICAgICAgXSwKICAgICAgICAgICAgb3B0aW9ucz17CiAgICAgICAgICAgICAgICAnZGJfdGFibGUnOiAnVXNlcicsCiAgICAgICAgICAgIH0sCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkNyZWF0ZU1vZGVsKAogICAgICAgICAgICBuYW1lPSd0b2RvJywKICAgICAgICAgICAgZmllbGRzPVsKICAgICAgICAgICAgICAgICgnaWQnLCBtb2RlbHMuQXV0b0ZpZWxkKHByaW1hcnlfa2V5PVRydWUsIHNlcmlhbGl6ZT1GYWxzZSkpLAogICAgICAgICAgICAgICAgKCdkZXNjcmlwdGlvbicsIG1vZGVscy5UZXh0RmllbGQoKSksCiAgICAgICAgICAgICAgICAoJ2lzQ29tcGxldGUnLCBtb2RlbHMuQm9vbGVhbkZpZWxkKCkpLAogICAgICAgICAgICAgICAgKCdkZWFkbGluZScsIG1vZGVscy5EYXRlRmllbGQoKSksCiAgICAgICAgICAgICAgICAoJ3N0YXJzJywgbW9kZWxzLkludGVnZXJGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgnYXNzaWduZWUnLCBtb2RlbHMuRm9yZWlnbktleShibGFuaz1UcnVlLCBkYl9jb2x1bW49J2Fzc2lnbmVlJywgbnVsbD1UcnVlLCBvbl9kZWxldGU9ZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbi5ET19OT1RISU5HLCByZWxhdGVkX25hbWU9JysnLCB0bz0nX2RqYW5nb19zY2hlbWEudXNlcicpKSwKICAgICAgICAgICAgXSwKICAgICAgICAgICAgb3B0aW9ucz17CiAgICAgICAgICAgICAgICAnZGJfdGFibGUnOiAnVG9kbycsCiAgICAgICAgICAgIH0sCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkNyZWF0ZU1vZGVsKAogICAgICAgICAgICBuYW1lPSd0ZXN0X3VzZXJzX21hbnknLAogICAgICAgICAgICBmaWVsZHM9WwogICAgICAgICAgICAgICAgKCdpZCcsIG1vZGVscy5BdXRvRmllbGQoYXV0b19jcmVhdGVkPVRydWUsIHByaW1hcnlfa2V5PVRydWUsIHNlcmlhbGl6ZT1GYWxzZSwgdmVyYm9zZV9uYW1lPSdJRCcpKSwKICAgICAgICAgICAgICAgICgnVGVzdF9sZWZ0X2lkJywgbW9kZWxzLkZvcmVpZ25LZXkoZGJfY29sdW1uPSdUZXN0X2xlZnRfaWQnLCBvbl9kZWxldGU9ZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbi5DQVNDQURFLCByZWxhdGVkX25hbWU9JysnLCB0bz0nX2RqYW5nb19zY2hlbWEudGVzdCcpKSwKICAgICAgICAgICAgICAgICgnVXNlcl9yaWdodF9pZCcsIG1vZGVscy5Gb3JlaWduS2V5KGRiX2NvbHVtbj0nVXNlcl9yaWdodF9pZCcsIG9uX2RlbGV0ZT1kamFuZ28uZGIubW9kZWxzLmRlbGV0aW9uLkNBU0NBREUsIHJlbGF0ZWRfbmFtZT0nKycsIHRvPSdfZGphbmdvX3NjaGVtYS51c2VyJykpLAogICAgICAgICAgICBdLAogICAgICAgICAgICBvcHRpb25zPXsKICAgICAgICAgICAgICAgICdkYl90YWJsZSc6ICdUZXN0X3VzZXJzX21hbnknLAogICAgICAgICAgICB9LAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5DcmVhdGVNb2RlbCgKICAgICAgICAgICAgbmFtZT0nZm9yZ290cGFzc3dvcmRhY3Rpb24nLAogICAgICAgICAgICBmaWVsZHM9WwogICAgICAgICAgICAgICAgKCdpZCcsIG1vZGVscy5BdXRvRmllbGQocHJpbWFyeV9rZXk9VHJ1ZSwgc2VyaWFsaXplPUZhbHNlKSksCiAgICAgICAgICAgICAgICAoJ3Rva2VuJywgbW9kZWxzLlRleHRGaWVsZCh1bmlxdWU9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCdyZXF1ZXN0ZWRBdF91dGMnLCBtb2RlbHMuRGF0ZVRpbWVGaWVsZCgpKSwKICAgICAgICAgICAgICAgICgncmVxdWVzdGVkQXRfb2Zmc2V0JywgbW9kZWxzLlRleHRGaWVsZCgpKSwKICAgICAgICAgICAgICAgICgnZXhwaXJlc0F0X3V0YycsIG1vZGVscy5EYXRlVGltZUZpZWxkKCkpLAogICAgICAgICAgICAgICAgKCdleHBpcmVzQXRfb2Zmc2V0JywgbW9kZWxzLlRleHRGaWVsZCgpKSwKICAgICAgICAgICAgICAgICgndXNlZEF0X3V0YycsIG1vZGVscy5EYXRlVGltZUZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCd1c2VkQXRfb2Zmc2V0JywgbW9kZWxzLlRleHRGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgndXBkYXRlZEF0X3V0YycsIG1vZGVscy5EYXRlVGltZUZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCd1cGRhdGVkQXRfb2Zmc2V0JywgbW9kZWxzLlRleHRGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgnY3JlYXRlZEF0X3V0YycsIG1vZGVscy5EYXRlVGltZUZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCdjcmVhdGVkQXRfb2Zmc2V0JywgbW9kZWxzLlRleHRGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgnY3JlYXRlZEJ5JywgbW9kZWxzLkZvcmVpZ25LZXkoYmxhbms9VHJ1ZSwgZGJfY29sdW1uPSdjcmVhdGVkQnknLCBudWxsPVRydWUsIG9uX2RlbGV0ZT1kamFuZ28uZGIubW9kZWxzLmRlbGV0aW9uLkRPX05PVEhJTkcsIHJlbGF0ZWRfbmFtZT0nKycsIHRvPSdfZGphbmdvX3NjaGVtYS51c2VyJykpLAogICAgICAgICAgICAgICAgKCd1cGRhdGVkQnknLCBtb2RlbHMuRm9yZWlnbktleShibGFuaz1UcnVlLCBkYl9jb2x1bW49J3VwZGF0ZWRCeScsIG51bGw9VHJ1ZSwgb25fZGVsZXRlPWRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24uRE9fTk9USElORywgcmVsYXRlZF9uYW1lPScrJywgdG89J19kamFuZ29fc2NoZW1hLnVzZXInKSksCiAgICAgICAgICAgICAgICAoJ3VzZXInLCBtb2RlbHMuRm9yZWlnbktleShibGFuaz1UcnVlLCBkYl9jb2x1bW49J3VzZXInLCBudWxsPVRydWUsIG9uX2RlbGV0ZT1kamFuZ28uZGIubW9kZWxzLmRlbGV0aW9uLkRPX05PVEhJTkcsIHJlbGF0ZWRfbmFtZT0nKycsIHRvPSdfZGphbmdvX3NjaGVtYS51c2VyJykpLAogICAgICAgICAgICBdLAogICAgICAgICAgICBvcHRpb25zPXsKICAgICAgICAgICAgICAgICdkYl90YWJsZSc6ICdGb3Jnb3RQYXNzd29yZEFjdGlvbicsCiAgICAgICAgICAgIH0sCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkNyZWF0ZU1vZGVsKAogICAgICAgICAgICBuYW1lPSdjb250ZW50dHlwZV90ZXN0X2JvZHknLAogICAgICAgICAgICBmaWVsZHM9WwogICAgICAgICAgICAgICAgKCdpZCcsIG1vZGVscy5BdXRvRmllbGQocHJpbWFyeV9rZXk9VHJ1ZSwgc2VyaWFsaXplPUZhbHNlKSksCiAgICAgICAgICAgICAgICAoJ2RvY3VtZW50JywgbW9kZWxzLlRleHRGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgnZnJvbV9maWVsZCcsIG1vZGVscy5Gb3JlaWduS2V5KGJsYW5rPVRydWUsIGRiX2NvbHVtbj0nZnJvbScsIG51bGw9VHJ1ZSwgb25fZGVsZXRlPWRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24uRE9fTk9USElORywgcmVsYXRlZF9uYW1lPScrJywgdG89J19kamFuZ29fc2NoZW1hLnRlc3QnKSksCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgIG9wdGlvbnM9ewogICAgICAgICAgICAgICAgJ2RiX3RhYmxlJzogJ19Db250ZW50VHlwZV9UZXN0X2JvZHknLAogICAgICAgICAgICB9LAogICAgICAgICksCiAgICBdCg== - -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:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMC42IG9uIDIwMjAtMDYtMDIgMTE6MjkKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKaW1wb3J0IGRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24KCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMDVfYXV0b18yMDIwMDUyOV8xOTMwJyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkNyZWF0ZU1vZGVsKAogICAgICAgICAgICBuYW1lPSdvcmdhbml6YXRpb24nLAogICAgICAgICAgICBmaWVsZHM9WwogICAgICAgICAgICAgICAgKCdpZCcsIG1vZGVscy5BdXRvRmllbGQocHJpbWFyeV9rZXk9VHJ1ZSwgc2VyaWFsaXplPUZhbHNlKSksCiAgICAgICAgICAgICAgICAoJ25hbWUnLCBtb2RlbHMuVGV4dEZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCdpc0FjdGl2ZScsIG1vZGVscy5Cb29sZWFuRmllbGQoKSksCiAgICAgICAgICAgICAgICAoJ3VwZGF0ZWRBdF91dGMnLCBtb2RlbHMuRGF0ZVRpbWVGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgndXBkYXRlZEF0X29mZnNldCcsIG1vZGVscy5UZXh0RmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSksCiAgICAgICAgICAgICAgICAoJ2NyZWF0ZWRBdF91dGMnLCBtb2RlbHMuRGF0ZVRpbWVGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgnY3JlYXRlZEF0X29mZnNldCcsIG1vZGVscy5UZXh0RmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSksCiAgICAgICAgICAgICAgICAoJ2NyZWF0ZWRCeScsIG1vZGVscy5Gb3JlaWduS2V5KGJsYW5rPVRydWUsIGRiX2NvbHVtbj0nY3JlYXRlZEJ5JywgbnVsbD1UcnVlLCBvbl9kZWxldGU9ZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbi5ET19OT1RISU5HLCByZWxhdGVkX25hbWU9JysnLCB0bz0nX2RqYW5nb19zY2hlbWEudXNlcicpKSwKICAgICAgICAgICAgICAgICgndXBkYXRlZEJ5JywgbW9kZWxzLkZvcmVpZ25LZXkoYmxhbms9VHJ1ZSwgZGJfY29sdW1uPSd1cGRhdGVkQnknLCBudWxsPVRydWUsIG9uX2RlbGV0ZT1kamFuZ28uZGIubW9kZWxzLmRlbGV0aW9uLkRPX05PVEhJTkcsIHJlbGF0ZWRfbmFtZT0nKycsIHRvPSdfZGphbmdvX3NjaGVtYS51c2VyJykpLAogICAgICAgICAgICBdLAogICAgICAgICAgICBvcHRpb25zPXsKICAgICAgICAgICAgICAgICdkYl90YWJsZSc6ICdPcmdhbml6YXRpb24nLAogICAgICAgICAgICB9LAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5DcmVhdGVNb2RlbCgKICAgICAgICAgICAgbmFtZT0nb3JnYW5pemF0aW9udG91c2VybGluaycsCiAgICAgICAgICAgIGZpZWxkcz1bCiAgICAgICAgICAgICAgICAoJ2lkJywgbW9kZWxzLkF1dG9GaWVsZCh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XphdGlvbicpKSwKICAgICAgICAgICAgICAgICgndXBkYXRlZEJ5JywgbW9kZWxzLkZvcmVpZ25LZXkoYmxhbms9VHJ1ZSwgZGJfY29sdW1uPSd1cGRhdGVkQnknLCBudWxsPVRydWUsIG9uX2RlbGV0ZT1kamFuZ28uZGIubW9kZWxzLmRlbGV0aW9uLkRPX05PVEhJTkcsIHJlbGF0ZWRfbmFtZT0nKycsIHRvPSdfZGphbmdvX3NjaGVtYS51c2VyJykpLAogICAgICAgICAgICAgICAgKCd1c2VyJywgbW9kZWxzLkZvcmVpZ25LZXkoYmxhbms9VHJ1ZSwgZGJfY29sdW1uPSd1c2VyJywgbnVsbD1UcnVlLCBvbl9kZWxldGU9ZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbi5ET19OT1RISU5HLCByZWxhdGVkX25hbWU9JysnLCB0bz0nX2RqYW5nb19zY2hlbWEudXNlcicpKSwKICAgICAgICAgICAgXSwKICAgICAgICAgICAgb3B0aW9ucz17CiAgICAgICAgICAgICAgICAnZGJfdGFibGUnOiAnT3JnYW5pemF0aW9uVG9Vc2VyTGluaycsCiAgICAgICAgICAgIH0sCiAgICAgICAgKSwKICAgIF0K - -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:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMC42IG9uIDIwMjAtMDYtMjcgMTA6MDIKCmltcG9ydCBkamFuZ28uY29udHJpYi5wb3N0Z3Jlcy5maWVsZHMuanNvbmIKZ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AgIG1pZ3JhdGlvbnMuQWx0ZXJGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndXNlcicsCiAgICAgICAgICAgIG5hbWU9J3NldHRpbmdzJywKICAgICAgICAgICAgZmllbGQ9ZGphbmdvLmNvbnRyaWIucG9zdGdyZXMuZmllbGRzLmpzb25iLkpTT05GaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpLAogICAgICAgICksCiAgICBdCg== - -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:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjAtMTEtMDUgMTE6MDIKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKaW1wb3J0IGRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24KCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMjFfYXV0b18yMDIwMTAxNl8wODM1JyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkFkZEZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd0ZXN0JywKICAgICAgICAgICAgbmFtZT0nY3JlYXRlZEF0X29mZnNldCcsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5UZXh0RmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWRkRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3QnLAogICAgICAgICAgICBuYW1lPSdjcmVhdGVkQXRfdXRjJywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLkRhdGVUaW1lRmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWRkRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3QnLAogICAgICAgICAgICBuYW1lPSdjcmVhdGVkQnknLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuRm9yZWlnbktleShibGFuaz1UcnVlLCBkYl9jb2x1bW49J2NyZWF0ZWRCeScsIG51bGw9VHJ1ZSwgb25fZGVsZXRlPWRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24uRE9fTk9USElORywgcmVsYXRlZF9uYW1lPScrJywgdG89J19kamFuZ29fc2NoZW1hLnVzZXInKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWRkRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3QnLAogICAgICAgICAgICBuYW1lPSd1cGRhdGVkQXRfb2Zmc2V0JywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLlRleHRGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BZGRGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdCcsCiAgICAgICAgICAgIG5hbWU9J3VwZGF0ZWRBdF91dGMnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuRGF0ZVRpbWVGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BZGRGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdCcsCiAgICAgICAgICAgIG5hbWU9J3VwZGF0ZWRCeScsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5Gb3JlaWduS2V5KGJsYW5rPVRydWUsIGRiX2NvbHVtbj0ndXBkYXRlZEJ5JywgbnVsbD1UcnVlLCBvbl9kZWxldGU9ZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbi5ET19OT1RISU5HLCByZWxhdGVkX25hbWU9JysnLCB0bz0nX2RqYW5nb19zY2hlbWEudXNlcicpLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BZGRGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdCcsCiAgICAgICAgICAgIG5hbWU9J3YnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuSW50ZWdlckZpZWxkKGRlZmF1bHQ9MSksCiAgICAgICAgKSwKICAgIF0K - -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_20201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sCiAgICAgICAgICAgIGZpZWxkPWRqYW5nby5jb250cmliLnBvc3RncmVzLmZpZWxkcy5qc29uYi5KU09ORmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWRkRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3QnLAogICAgICAgICAgICBuYW1lPSdwYXNzX2ZpZWxkJywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLkNoYXJGaWVsZChibGFuaz1UcnVlLCBkYl9jb2x1bW49J3Bhc3MnLCBtYXhfbGVuZ3RoPTYwLCBudWxsPVRydWUpLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BZGRGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdCcsCiAgICAgICAgICAgIG5hbWU9J3V0YycsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5EYXRlVGltZUZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgIF0K - -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:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjAtMTEtMDYgMjE6NDUKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKaW1wb3J0IGRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24KCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMjVfYXV0b18yMDIwMTEwNl8yMDMzJyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J29yZ2FuaXphdGlvbicsCiAgICAgICAgICAgIG5hbWU9J2F2YXRhcicsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5KU09ORmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWx0ZXJGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdCcsCiAgICAgICAgICAgIG5hbWU9J2ZpbGUnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuSlNPTkZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3QnLAogICAgICAgICAgICBuYW1lPSdtZXRhJywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLkpTT05GaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BbHRlckZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd0ZXN0JywKICAgICAgICAgICAgbmFtZT0nc2V0dGluZ3MnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuSlNPTkZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3QnLAogICAgICAgICAgICBuYW1lPSd2ZW51ZScsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5KU09ORmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWx0ZXJGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndXNlcicsCiAgICAgICAgICAgIG5hbWU9J2F2YXRhcicsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5KU09ORmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWx0ZXJGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndXNlcicsCiAgICAgICAgICAgIG5hbWU9J21ldGEnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuSlNPTkZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgICA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ICAgKCdyYXRpbmcxJywgbW9kZWxzLkludGVnZXJGaWVsZCgpKSwKICAgICAgICAgICAgICAgICgncmF0aW5nMicsIG1vZGVscy5EZWNpbWFsRmllbGQoYmxhbms9VHJ1ZSwgZGVjaW1hbF9wbGFjZXM9MiwgbWF4X2RpZ2l0cz04LCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgncmF0aW5nMycsIG1vZGVscy5EZWNpbWFsRmllbGQoYmxhbms9VHJ1ZSwgZGVjaW1hbF9wbGFjZXM9NCwgbWF4X2RpZ2l0cz0xOCwgbnVsbD1UcnVlKSksCiAgICAgICAgICAgICAgICAoJ3ZlbnVlJywgbW9kZWxzLkpTT05GaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgnc3RhdHVzX3JlbmFtZWQnLCBtb2RlbHMuQ2hhckZpZWxkKGNob2ljZXM9WygncGVuZGluZycsICdwZW5kaW5nJyksICgncHJvY2Vzc2VkJywgJ3Byb2Nlc3NlZCcpXSwgbWF4X2xlbmd0aD01MCkpLAogICAgICAgICAgICAgICAgKCd1dWlkJywgbW9kZWxzLlVVSURGaWVsZCgpKSwKICAgICAgICAgICAgICAgICgndXJsJywgbW9kZWxzLlRleHRGaWVsZCgpKSwKICAgICAgICAgICAgICAgICgnc2x1ZycsIG1vZGVscy5UZXh0RmllbGQodW5pcXVlPVRydWUpKSwKICAgICAgICAgICAgICAgICgncmF0aW5nJywgbW9kZWxzLkludGVnZXJGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgnc2V0dGluZ3MnLCBtb2RlbHMuSlNPTkZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCdtZXRhJywgbW9kZWxzLkpTT05GaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgndGV4dCcsIG1vZGVscy5UZXh0RmllbGQoYmxhbms9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b25fZGVsZXRlPWRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24uRE9fTk9USElORywgcmVsYXRlZF9uYW1lPScrJywgdG89J19kamFuZ29fc2NoZW1hLnRlc3RfaGlzdG9yeScpLAogICAgICAgICksCiAgICBdCg== - -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:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjAtMTEtMDcgMDg6NTQKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKaW1wb3J0IGRqYW5nby5kYi5tb2R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dG89J19kamFuZ29fc2NoZW1hLnVzZXInKSksCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgIG9wdGlvbnM9ewogICAgICAgICAgICAgICAgJ2RiX3RhYmxlJzogJ1Rlc3RJdGVtX2hpc3RvcnknLAogICAgICAgICAgICB9LAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BZGRGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdGl0ZW0nLAogICAgICAgICAgICBuYW1lPSdoaXN0b3J5JywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLkZvcmVpZ25LZXkoYmxhbms9VHJ1ZSwgZGJfY29sdW1uPSdoaXN0b3J5JywgbnVsbD1UcnVlLCBvbl9kZWxldGU9ZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbi5ET19OT1RISU5HLCByZWxhdGVkX25hbWU9JysnLCB0bz0nX2RqYW5nb19zY2hlbWEudGVzdGl0ZW1faGlzdG9yeScpLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BZGRGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdGl0ZW0nLAogICAgICAgICAgICBuYW1lPSd0ZXN0JywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLkZvcmVpZ25LZXkoYmxhbms9VHJ1ZSwgZGJfY29sdW1uPSd0ZXN0JywgbnVsbD1UcnVlLCBvbl9kZWxldGU9ZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbi5ET19OT1RISU5HLCByZWxhdGVkX25hbWU9JysnLCB0bz0nX2RqYW5nb19zY2hlbWEudGVzdCcpLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BZGRGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdGl0ZW0nLAogICAgICAgICAgICBuYW1lPSd1cGRhdGVkQnknLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuRm9yZWlnbktleShibGFuaz1UcnVlLCBkYl9jb2x1bW49J3VwZGF0ZWRCeScsIG51bGw9VHJ1ZSwgb25fZGVsZXRlPWRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24uRE9fTk9USElORywgcmVsYXRlZF9uYW1lPScrJywgdG89J19kamFuZ29fc2NoZW1hLnVzZXInKSwKICAgICAgICApLAogICAgXQo= - -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:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjAtMTEtMDggMDk6NTUKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKaW1wb3J0IGRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24KCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMjdfYXV0b18yMDIwMTEwN18wODU0JyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkNyZWF0ZU1vZGVsKAogICAgICAgICAgICBuYW1lPSd0ZXN0aGlzdG9yeXJlY29yZCcsCiAgICAgICAgICAgIGZpZWxkcz1bCiAgICAgICAgICAgICAgICAoJ2RhdGUxX3V0YycsIG1vZGVscy5EYXRlVGltZUZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCdkYXRlMV9vZmZzZXQnLCBtb2RlbHMuVGV4dEZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCd1dGMnLCBtb2RlbHMuRGF0ZVRpbWVGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgnZGF5JywgbW9kZWxzLkRhdGVGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICA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wnLCBtb2RlbHMuVGV4dEZpZWxkKCkpLAogICAgICAgICAgICAgICAgKCdzbHVnJywgbW9kZWxzLlRleHRGaWVsZCh1bmlxdWU9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCdyYXRpbmcnLCBtb2RlbHMuSW50ZWdlckZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCdzZXR0aW5ncycsIG1vZGVscy5KU09ORmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSksCiAgICAgICAgICAgICAgICAoJ21ldGEnLCBtb2RlbHMuSlNPTkZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCd0ZXh0JywgbW9kZWxzLlRleHRGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgndXBkYXRlZEF0X3V0YycsIG1vZGVscy5EYXRlVGltZUZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCd1cGRhdGVkQXRfb2Zmc2V0JywgbW9kZWxzLlRleHRGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgnY3JlYXRlZEF0X3V0YycsIG1vZGVscy5EYXRlVGltZUZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCdjcmVhdGVkQXRfb2Zmc2V0JywgbW9kZWxzLlRleHRGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgndicsIG1vZGVscy5JbnRlZ2VyRmllbGQoZGVmYXVsdD0xKSksCiAgICAgICAgICAgICAgICAoJ2lkJywgbW9kZWxzLlVVSURGaWVsZChwcmltYXJ5X2tleT1UcnVlLCBzZXJpYWxpemU9RmFsc2UpKSwKICAgICAgICAgICAgICAgICgnaGlzdG9yeV9kYXRlJywgbW9kZWxzLkRhdGVUaW1lRmllbGQoKSksCiAgICAgICAgICAgICAgICAoJ2hpc3RvcnlfYWN0aW9uJywgbW9kZWxzLkNoYXJGaWVsZChjaG9pY2VzPVsoJ2MnLCAnYycpLCAoJ3UnLCAndScpLCAoJ2QnLCAnZCcpXSwgbWF4X2xlbmd0aD01MCkpLAogICAgICAgICAgICAgICAgKCdjcmVhdGVkQnknLCBtb2RlbHMuRm9yZWlnbktleShibGFuaz1UcnVlLCBkYl9jb2x1bW49J2NyZWF0ZWRCeScsIG51bGw9VHJ1ZSwgb25fZGVsZXRlPWRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24uRE9fTk9USElORywgcmVsYXRlZF9uYW1lPScrJywgdG89J19kamFuZ29fc2NoZW1hLnVzZXInKSksCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgIG9wdGlvbnM9ewogICAgICAgICAgICAgICAgJ2RiX3RhYmxlJzogJ1Rlc3RIaXN0b3J5UmVjb3JkJywKICAgICAgICAgICAgfSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuUmVuYW1lTW9kZWwoCiAgICAgICAgICAgIG9sZF9uYW1lPSd0ZXN0aXRlbV9oaXN0b3J5JywKICAgICAgICAgICAgbmV3X25hbWU9J3Rlc3RpdGVtaGlzdG9yeXJlY29yZCcsCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLlJlbW92ZUZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd0ZXN0JywKICAgICAgICAgICAgbmFtZT0naGlzdG9yeScsCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLlJlbW92ZUZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd0ZXN0aXRlbScsCiAgICAgICAgICAgIG5hbWU9J2hpc3RvcnknLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BbHRlckZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd0ZXN0JywKICAgICAgICAgICAgbmFtZT0nc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HRvPSdfZGphbmdvX3NjaGVtYS50ZXN0JyksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFkZEZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd0ZXN0aGlzdG9yeXJlY29yZCcsCiAgICAgICAgICAgIG5hbWU9J3VwZGF0ZWRCeScsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5Gb3JlaWduS2V5KGJsYW5rPVRydWUsIGRiX2NvbHVtbj0ndXBkYXRlZEJ5JywgbnVsbD1UcnVlLCBvbl9kZWxldGU9ZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbi5ET19OT1RISU5HLCByZWxhdGVkX25hbWU9JysnLCB0bz0nX2RqYW5nb19zY2hlbWEudXNlcicpLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5EZWxldGVNb2RlbCgKICAgICAgICAgICAgbmFtZT0ndGVzdF9oaXN0b3J5JywKICAgICAgICApLAogICAgXQo= - -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: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XRpb25zLkRlbGV0ZU1vZGVsKAogICAgICAgICAgICBuYW1lPSd0ZXN0aGlzdG9yeXJlY29yZCcsCiAgICAgICAgKSwKICAgIF0K - -exports.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:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjAtMTEtMDggMjI6MDIKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKaW1wb3J0IGRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24KCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMzFfYXV0b18yMDIwMTEwOF8yMjAxJyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkNyZWF0ZU1vZGVsKAogICAgICAgICAgICBuYW1lPSd0ZXN0aXRlbWhpc3RvcnlyZWNvcmQnLAogICAgICAgICAgICBmaWVsZHM9WwogICAgICAgICAgICAgICAgKCdpZCcsIG1vZGVscy5VVUlERmllbGQocHJpbWFyeV9rZXk9VHJ1ZSwgc2VyaWFsaXplPUZhbHNlKSksCiAgICAgICAgICAgICAgICAoJ21ldGEnLCBtb2RlbHMuSlNPTkZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCd1cGRhdGVkQXRfdXRjJywgbW9kZWxzLkRhdGVUaW1lRmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSksCiAgICAgICAgICAgICAgICA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kamFuZ28uZGIubW9kZWxzLmRlbGV0aW9uLkRPX05PVEhJTkcsIHJlbGF0ZWRfbmFtZT0nKycsIHRvPSdfZGphbmdvX3NjaGVtYS50ZXN0JykpLAogICAgICAgICAgICAgICAgKCd1cGRhdGVkQnknLCBtb2RlbHMuRm9yZWlnbktleShibGFuaz1UcnVlLCBkYl9jb2x1bW49J3VwZGF0ZWRCeScsIG51bGw9VHJ1ZSwgb25fZGVsZXRlPWRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24uRE9fTk9USElORywgcmVsYXRlZF9uYW1lPScrJywgdG89J19kamFuZ29fc2NoZW1hLnVzZXInKSksCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgIG9wdGlvbnM9ewogICAgICAgICAgICAgICAgJ2RiX3RhYmxlJzogJ1Rlc3RIaXN0b3J5UmVjb3JkJywKICAgICAgICAgICAgfSwKICAgICAgICApLAogICAgXQo= - -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:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjAtMTEtMDggMjI6MDcKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKaW1wb3J0IGRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24KCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMzJfdGVzdGhpc3RvcnlyZWNvcmRfdGVzdGl0ZW1oaXN0b3J5cmVjb3JkJyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgIC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ywKICAgICAgICAgICAgbmFtZT0ndXBkYXRlZEJ5JywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLkZvcmVpZ25LZXkoYmxhbms9VHJ1ZSwgZGJfY29sdW1uPSd1cGRhdGVkQnknLCBkYl9jb25zdHJhaW50PUZhbHNlLCBkYl9pbmRleD1GYWxzZSwgbnVsbD1UcnVlLCBvbl9kZWxldGU9ZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbi5ET19OT1RISU5HLCByZWxhdGVkX25hbWU9JysnLCB0bz0nX2RqYW5nb19zY2hlbWEudXNlcicpLAogICAgICAgICksCiAgICBdCg== - -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:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjAtMTEtMDkgMjE6MjgKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMzNfYXV0b18yMDIwMTEwOF8yMjA3JyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9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gICAgZmllbGQ9bW9kZWxzLlBvc2l0aXZlSW50ZWdlckZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3RpdGVtaGlzdG9yeXJlY29yZCcsCiAgICAgICAgICAgIG5hbWU9J2hpc3RvcnlfaWQnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuVVVJREZpZWxkKCksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3RpdGVtaGlzdG9yeXJlY29yZCcsCiAgICAgICAgICAgIG5hbWU9J3Rlc3QnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuUG9zaXRpdmVJbnRlZ2VyRmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWx0ZXJGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdGl0ZW1oaXN0b3J5cmVjb3JkJywKICAgICAgICAgICAgbmFtZT0ndXBkYXRlZEJ5JywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLlBvc2l0aXZlSW50ZWdlckZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgIF0K - -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:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjAtMTEtMTQgMTI6MTYKCmZyb20gZGphbmdvLmRiIGltcG9ydCBtaWdyYXRpb25zLCBtb2RlbHMKaW1wb3J0IGRqYW5nby5kYi5tb2RlbHMuZGVsZXRpb24KCgpjbGFzcyBNaWdyYXRpb24obWlncmF0aW9ucy5NaWdyYXRpb24pOgoKICAgIGRlcGVuZGVuY2llcyA9IFsKICAgICAgICAoJ19kamFuZ29fc2NoZW1hJywgJzAwMzZfYXV0b18yMDIwMTExM18wOTQxJyksCiAgICBdCgogICAgb3BlcmF0aW9ucyA9IFsKICAgICAgICBtaWdyYXRpb25zLkNyZWF0ZU1vZGVsKAogICAgICAgICAgICBuYW1lPSd0ZXN0c29mdGRlbGV0ZWRvYmpoaXN0b3J5cmVjb3JkJywKICAgICAgICAgICAgZmllbGRzPVsKICAgICAgICAgICAgICAgICgnbWV0YScsIG1vZGVscy5KU09ORmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSksCiAgICAgICAgICAgICAgICAoJ3YnLCBtb2RlbHMuSW50ZWdlckZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCdjcmVhdGVkQXQnLCBtb2RlbHMuRGF0ZVRpbWVGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgndXBkYXRlZEF0JywgbW9kZWxzLkRhdGVUaW1lRmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSksCiAgICAgICAgICAgICAgICAoJ2NyZWF0ZWRCeScsIG1vZGVscy5Qb3NpdGl2ZUludGVnZXJGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgndXBkYXRlZEJ5JywgbW9kZWxzLlBvc2l0aXZlSW50ZWdlckZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSkpLAogICAgICAgICAgICAgICAgKCdkZWxldGVkQXQnLCBtb2RlbHMuRGF0ZVRpbWVGaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpKSwKICAgICAgICAgICAgICAgICgnaWQnLCBtb2RlbHMuVVVJREZpZWxkKHByaW1hcnlfa2V5PVRydWUsIHNlcmlhbGl6ZT1GYWxzZSkpLAogICAgICAgICAgICAgICAgKCdoaXN0b3J5X2RhdGUnLCBtb2RlbHMuRGF0ZVRpbWVGaWVsZCgpKSwKICAgICAgICAgICAgICAgICgnaGlzdG9yeV9hY3Rpb24nLCBtb2RlbHMuQ2hhckZpZWxkKGNob2ljZXM9WygnYycsICdjJyksICgndScsICd1JyksICgnZCcsICdkJyldLCBtYXhfbGVuZ3RoPTUwKSksCiAgICAgICAgICAgICAgICAoJ2hpc3RvcnlfaWQnLCBtb2RlbHMuUG9zaXRpdmVJbnRlZ2VyRmllbGQoKSksCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgIG9wdGlvbnM9ewogICAgICAgICAgICAgICAgJ2RiX3RhYmxlJzogJ1Rlc3RTb2Z0RGVsZXRlZE9iakhpc3RvcnlSZWNvcmQnLAogICAgICAgICAgICB9LAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5DcmVhdGVNb2RlbCgKICAgICAgICAgICAgbmFtZT0ndGVzdHNvZnRk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AgICBvcHRpb25zPXsKICAgICAgICAgICAgICAgICdkYl90YWJsZSc6ICdUZXN0U29mdERlbGV0ZWRPYmonLAogICAgICAgICAgICB9LAogICAgICAgICksCiAgICBdCg== - -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:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDMuMS4yIG9uIDIwMjEtMDItMDMgMjE6NTIKCmltcG9ydCBkamFuZ28uY29udHJpYi5wb3N0Z3Jlcy5maWVsZHMuanNvbmIKZnJvbSBkamFuZ28uZGIgaW1wb3J0IG1pZ3JhdGlvbnMsIG1vZGVscwoKCmNsYXNzIE1pZ3JhdGlvbihtaWdyYXRpb25zLk1pZ3JhdGlvbik6CgogICAgZGVwZW5kZW5jaWVzID0gWwogICAgICAgICgnX2RqYW5nb19zY2hlbWEnLCAnMDA0Ml90ZXN0YXV0b2luY3JlbWVudG51bWJlcicpLAogICAgXQoKICAgIG9wZXJhdGlvbnMgPSBbCiAgICAgICAgbWlncmF0aW9ucy5SZW1vdmVGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndXNlcicsCiAgICAgICAgICAgIG5hbWU9J3JhdGluZycsCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLlJlbW92ZUZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd1c2VyJywKICAgICAgICAgICAgbmFtZT0nc2V0dGluZ3MnLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BbHRlckZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSdvcmdhbml6YXRpb24nLAogICAgICAgICAgICBuYW1lPSdhdmF0YXInLAogICAgICAgICAgICBmaWVsZD1kamFuZ28uY29udHJpYi5wb3N0Z3Jlcy5maWVsZHMuanNvbmIuSlNPTkZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3QnLAogICAgICAgICAgICBuYW1lPSdjcmVhdGVkQXQnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuRGF0ZVRpbWVGaWVsZChibGFuaz1UcnVlLCBkYl9pbmRleD1UcnVlLCBudWxsPVRydWUpLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BbHRlckZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd0ZXN0JywKICAgICAgICAgICAgbmFtZT0nZmlsZScsCiAgICAgICAgICAgIGZpZWxkPWRqYW5nby5jb250cmliLnBvc3RncmVzLmZpZWxkcy5qc29uYi5KU09ORmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWx0ZXJGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdCcsCiAgICAgICAgICAgIG5hbWU9J21ldGEnLAogICAgICAgICAgICBmaWVsZD1kamFuZ28uY29udHJpYi5wb3N0Z3Jlcy5maWVsZHMuanNvbmIuSlNPTkZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3QnLAogICAgICAgICAgICBuYW1lPSdzZXR0aW5ncycsCiAgICAgICAgICAgIGZpZWxkPWRqYW5nby5jb250cmliLnBvc3RncmVzLmZpZWxkcy5qc29uYi5KU09ORmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWx0ZXJGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdCcsCiAgICAgICAgICAgIG5hbWU9J3VwZGF0ZWRBdCcsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5EYXRlVGltZUZpZWxkKGJsYW5rPVRydWUsIGRiX2luZGV4PVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3QnLAogICAgICAgICAgICBuYW1lPSd2ZW51ZScsCiAgICAgICAgICAgIGZpZWxkPWRqYW5nby5jb250cmliLnBvc3RncmVzLmZpZWxkcy5qc29uYi5KU09ORmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWx0ZXJGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndGVzdGhpc3RvcnlyZWNvcmQnLAogICAgICAgICAgICBuYW1lPSdmaWxlJywKICAgICAgICAgICAgZmllbGQ9ZGphbmdvLmNvbnRyaWIucG9zdGdyZXMuZmllbGRzLmpzb25iLkpTT05GaWVsZChibGFuaz1UcnVlLCBudWxsPVRydWUpLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BbHRlckZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd0ZXN0aGlzdG9yeXJlY29yZCcsCiAgICAgICAgICAgIG5hbWU9J21ldGEnLAogICAgICAgICAgICBmaWVsZD1kamFuZ28uY29udHJpYi5wb3N0Z3Jlcy5maWVsZHMuanNvbmIuSlNPTkZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3RoaXN0b3J5cmVjb3JkJywKICAgICAgICAgICAgbmFtZT0nc2V0dGluZ3MnLAogICAgICAgICAgICBmaWVsZD1kamFuZ28uY29udHJpYi5wb3N0Z3Jlcy5maWVsZHMuanNvbmIuSlNPTkZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3RoaXN0b3J5cmVjb3JkJywKICAgICAgICAgICAgbmFtZT0ndmVudWUnLAogICAgICAgICAgICBmaWVsZD1kamFuZ28uY29udHJpYi5wb3N0Z3Jlcy5maWVsZHMuanNvbmIuSlNPTkZpZW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GEnLAogICAgICAgICAgICBmaWVsZD1kamFuZ28uY29udHJpYi5wb3N0Z3Jlcy5maWVsZHMuanNvbmIuSlNPTkZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3Rlc3Rzb2Z0ZGVsZXRlZG9iamhpc3RvcnlyZWNvcmQnLAogICAgICAgICAgICBuYW1lPSduZXdJZCcsCiAgICAgICAgICAgIGZpZWxkPWRqYW5nby5jb250cmliLnBvc3RncmVzLmZpZWxkcy5qc29uYi5KU09ORmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWx0ZXJGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndXNlcicsCiAgICAgICAgICAgIG5hbWU9J2F2YXRhcicsCiAgICAgICAgICAgIGZpZWxkPWRqYW5nby5jb250cmliLnBvc3RncmVzLmZpZWxkcy5qc29uYi5KU09ORmllbGQoYmxhbms9VHJ1ZSwgbnVsbD1UcnVlKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWx0ZXJGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndXNlcicsCiAgICAgICAgICAgIG5hbWU9J21ldGEnLAogICAgICAgICAgICBmaWVsZD1kamFuZ28uY29udHJpYi5wb3N0Z3Jlcy5maWVsZHMuanNvbmIuSlNPTkZpZWxkKGJsYW5rPVRydWUsIG51bGw9VHJ1ZSksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkRlbGV0ZU1vZGVsKAogICAgICAgICAgICBuYW1lPSd0b2RvJywKICAgICAgICApLAogICAgXQo= - -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/bin/createapp b/bin/createapp deleted file mode 100644 index ca4ef82b..00000000 --- a/bin/createapp +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env node - -const { createapp } = require('@core/codegen') -createapp(process.argv) diff --git a/bin/kmigrator.py b/bin/kmigrator.py deleted file mode 100755 index 9d884aca..00000000 --- a/bin/kmigrator.py +++ /dev/null @@ -1,646 +0,0 @@ -#!/usr/bin/env python3 - -import sys - -if sys.version_info[0] < 3: - print("ERROR: required Python version >= 3.5") - sys.exit(1) -try: - import django - if django.VERSION[0] < 3: - print("ERROR: Django is {}! required version >= 3.0.6".format(django.VERSION)) - print("TRY TO FIX BY COMMAND: '{} -m pip install \"Django>=3.0.6\"'".format(sys.executable)) - sys.exit(1) -except: - print("ERROR: required Django version >= 3.0") - print("TRY TO FIX BY COMMAND: '{} -m pip install \"Django>=3.0.6\"'".format(sys.executable)) - sys.exit(1) -try: - import psycopg2 -except: - print("ERROR: required Psycopg") - print("TRY TO FIX BY COMMAND: '{} -m pip install \"psycopg2-binary>=2.8.5\"'".format(sys.executable)) - sys.exit(1) - -import base64 -import os -import re -import shutil -import subprocess -from datetime import datetime -from pathlib import Path -from time import time - -VERSION = (1, 1, 6) -CACHE_DIR = Path('.kmigrator') -KNEX_MIGRATIONS_DIR = Path('migrations') -GET_KNEX_SETTINGS_SCRIPT = CACHE_DIR / 'get.knex.settings.js' -KNEX_MIGRATE_SCRIPT = CACHE_DIR / 'knex.run.js' -GET_KNEX_SETTINGS_LOG = CACHE_DIR / 'get.knex.settings.log' -DJANGO_DIR = CACHE_DIR / '_django_schema' -DJANGO_MODEL_GENERATOR_SCRIPT = ''' -import json -from django.template import Library, Template, Engine, Context -import keyword -import sys - -DATA = '__KNEX_SCHEMA_DATA__' -NAME = '_django_model_generator' -MODELS_TPL = """ -from django.db import models -from django.contrib.postgres.fields import JSONField - -{% for tablename, fields in schema.items %} -class {{ tablename|to_classname }}(models.Model): - {% for fieldname, field in fields.items %} - {{ fieldname|to_fieldname }} = {{ field|to_fieldtype:fieldname|safe }}{% endfor %} - - class Meta: - db_table = '{{ tablename|to_tablename }}' - -{% endfor %} -""" - -register = Library() - - -@register.filter -def to_classname(value): - """ - >>> to_classname('public._ContentType_Test_body') - 'ContentType_Test_body' - """ - value = value.replace("public.", "").strip('_').lower() - return value - - -@register.filter -def to_tablename(value): - if value.startswith('public.'): - return value.replace("public.", "") - return value - - -@register.filter -def to_fieldname(value): - """ - >>> to_fieldname('for') - 'for_field' - >>> to_fieldname('_ContentType_Test_body') - 'ContentType_Test_body' - """ - value = value.strip('_') - if keyword.iskeyword(value): - return value + '_field' - return value - - -@register.filter -def to_fieldtype(value, fieldname=None): - """ - >>> to_fieldtype([['increments'], ['notNullable']]) - 'models.AutoField(primary_key=True)' - >>> to_fieldtype([["uuid"], ["primary"], ["notNullable"]]) - 'models.UUIDField(primary_key=True)' - >>> to_fieldtype([['text']]) - 'models.TextField(null=True, blank=True)' - >>> to_fieldtype([["integer"],["unsigned"],["index"],["foreign"],["references","id"],["inTable","public.Condo"]]) - 'models.ForeignKey(null=True, blank=True, on_delete=models.DO_NOTHING, related_name="+", to="Condo")' - >>> to_fieldtype([ [ "text" ], [ "unique" ] ]) - 'models.TextField(unique=True, null=True, blank=True)' - >>> to_fieldtype([ [ "text" ], [ "unique" ], ['notNullable'] ]) - 'models.TextField(unique=True)' - >>> to_fieldtype([["float", 8, 2]]) - 'models.DecimalField(null=True, blank=True, max_digits=8, decimal_places=2)' - >>> to_fieldtype([["decimal", 8, 2]]) - 'models.DecimalField(null=True, blank=True, max_digits=8, decimal_places=2)' - >>> to_fieldtype([["enum", ["pending", "processed"]], ["notNullable"]]) - "models.CharField(max_length=50, choices=[('pending', 'pending'), ('processed', 'processed')])" - >>> to_fieldtype([["enum", [1, 19]], ["notNullable"]]) - "models.IntegerField(choices=[(1, '1'), (19, '19')])" - """ - q = json.dumps - processors = { - "notNullable": lambda x: x.update({'null': False, 'blank': False}), - "uuid": lambda x: x.update({'field_class': 'models.UUIDField'}), - "text": lambda x: x.update({'field_class': 'models.TextField'}), - "float": lambda x, p1, p2: x.update( - {'field_class': 'models.DecimalField', 'max_digits': p1, 'decimal_places': p2}), - "decimal": lambda x, p1, p2: x.update( - {'field_class': 'models.DecimalField', 'max_digits': p1, 'decimal_places': p2}), - "unique": lambda x: x.update({'unique': True}), - "boolean": lambda x: x.update({'field_class': 'models.BooleanField'}), - "string": lambda x, max_length: x.update({'field_class': 'models.CharField', 'max_length': max_length}), - "json": lambda x: x.update({'field_class': 'JSONField'}), - "date": lambda x: x.update({'field_class': 'models.DateField'}), - "timestamp": lambda x, tz, precision: x.update({'field_class': 'models.DateTimeField'}), - "integer": lambda x: x.update({'field_class': 'models.IntegerField'}), - "unsigned": lambda x: x.update({'field_class': 'models.PositiveIntegerField'}), - "index": lambda x: x.update({'db_index': True}), - "foreign": lambda x: x.update( - {'field_class': 'models.ForeignKey', 'on_delete': 'models.DO_NOTHING', 'related_name': q('+')}), - "references": lambda x, to_field: x.update({'field_class': 'models.ForeignKey', 'to_field': q(to_field)}), - "inTable": lambda x, to_table: x.update({'field_class': 'models.ForeignKey', 'to': q(to_classname(to_table))}), - "onDelete": lambda x, on_delete: x.update( - {'field_class': 'models.ForeignKey', 'on_delete': 'models.' + on_delete}), - "enum": lambda x, choices: x.update( - {'field_class': 'models.IntegerField', 'choices': [(i, str(i)) for i in choices]}) if type( - choices[0]) == int else x.update( - {'field_class': 'models.CharField', 'max_length': 50, 'choices': [(i, i) for i in choices]}), - "defaultTo": lambda x, v: x.update({'default': v}), - "kmigrator": lambda x, options: x.update(options), - } - - if ['increments'] in value: - return 'models.AutoField(primary_key=True)' - if ["uuid"] in value and ["primary"] in value: - return 'models.UUIDField(primary_key=True)' - ctx = dict(field_class='JSONField', - db_index=False, unique=False, - null=True, blank=True) - if fieldname: - ctx.update({'db_column': q(fieldname)}) - for v in value: - if v[0] not in processors: - raise RuntimeError('no processor: {0}(ctx, *{1!r})'.format(v[0], v[1:])) - processors[v[0]](ctx, *v[1:]) - field_class = ctx.pop('field_class') - if not ctx['db_index'] and field_class != 'models.ForeignKey': - ctx.pop('db_index') - elif ctx['db_index'] and field_class == 'models.ForeignKey': - ctx.pop('db_index') - if not ctx['unique']: - ctx.pop('unique') - if not ctx['null'] and not ctx['blank']: - ctx.pop('null') - ctx.pop('blank') - if ctx.get('to_field') == '"id"': - ctx.pop('to_field') - if ctx.get('db_column') and fieldname == to_fieldname(fieldname) and field_class != 'models.ForeignKey': - ctx.pop('db_column') - ctx_line = ', '.join(['{}={}'.format(k, v) for k, v in ctx.items()]) - return '{}({})'.format(field_class, ctx_line) - - -def main(): - engine = Engine(libraries={NAME: NAME}, builtins=[NAME]) - template = Template(MODELS_TPL, engine=engine) - # data = sorted(json.loads(DATA).items(), key=lambda x: 0 if '_' in x[0] else 1) - context = Context({"schema": json.loads(DATA)}) - models = template.render(context) - print(models) - - -if __name__ == '__main__': - main() -''' -GET_KEYSTONE_SCHEMA_SCRIPT = """ -const entryFile = '__KEYSTONE_ENTRY_PATH__' -const knexSchemaFile = '__KNEX_SCHEMA_PATH__' -const knexConnectionFile = '__KNEX_CONNECTION_PATH__' -const knexMigrationsDir = '__KNEX_MIGRATION_DIR__' - -const { asyncForEach } = require('@keystonejs/utils') -const path = require('path') -const fs = require('fs') -const util = require('util') -const { keystone } = require(path.resolve(entryFile)) - -const tableCache = {} -let hasKnexConnection = false - -function createFakeTable (tableName) { - if (tableCache[tableName]) return tableCache[tableName] - - const schema = new Proxy({}, { - get: function (target, prop, receiver) { - if (!target.hasOwnProperty(prop)) target[prop] = [] - return target[prop] - }, - }) - - function chinable(name, args) { - if (!Array.isArray(args)) throw new Error('array required!') - schema[name].push(args) - const p = new Proxy({}, { - get: function (target, prop) { - return (...args) => { - try { - JSON.stringify(args) - } catch (e) { - // knex.raw may not to be serializable - console.warn('IS_NOT_SERIALIZABLE:', tableName, name, args, e) - return p - } - schema[name].push([prop].concat(args)) - return p - } - }, - }) - return p - } - - const table = { - toJSON: () => { return {...schema} }, - dropColumn: (name) => {throw new Error('dropColumn() not supported')}, - dropColumns: (...columns) => {throw new Error('dropColumns() not supported')}, - renameColumn: (from, to) => {throw new Error('renameColumn() not supported')}, - increments: (name) => chinable(name, ['increments']), - integer: (name) => chinable(name, ['integer']), - bigInteger: (name) => chinable(name, ['bigInteger']), - text: (name) => chinable(name, ['text']), - string: (name, length = 255) => chinable(name, ['string', length]), - binary: (name, length = 255) => chinable(name, ['binary', length]), - float: (name, precision = 8, scale = 2) => chinable(name, ['float', precision, scale]), - decimal: (name, precision = 8, scale = 2) => chinable(name, ['decimal', precision, scale]), - boolean: (name) => chinable(name, ['boolean']), - date: (name) => chinable(name, ['date']), - datetime: (name) => chinable(name, ['datetime']), - time: (name) => chinable(name, ['time']), - timestamp: (name, {useTz, precision} = {}) => { - return chinable(name, ['timestamp', Boolean(useTz), precision]) - }, - // timestamp: (name, {useTz, precision} = {}) => {throw new Error('timestamp() not supported')}, - timestamps: () => {throw new Error('timestamps() not supported')}, - dropTimestamps: () => {throw new Error('dropTimestamps() not supported')}, - enu: (name, values) => chinable(name, ['enum', values]), - enum: (name, values) => chinable(name, ['enum', values]), - json: (name) => chinable(name, ['json']), - jsonb: (name) => chinable(name, ['json']), - uuid: (name) => chinable(name, ['uuid']), - comment: (value) => {throw new Error('comment() not supported')}, - engine: (value) => {throw new Error('engine() not supported')}, - charset: (value) => {throw new Error('charset() not supported')}, - collate: (value) => {throw new Error('collate() not supported')}, - inherits: (value) => {throw new Error('inherits() not supported')}, - specificType: (name, type) => {throw new Error('specificType() not supported')}, - index: (columns, indexName, indexType) => {throw new Error('index() not supported')}, - dropIndex: (columns, indexName) => {throw new Error('dropIndex() not supported')}, - unique: (columns, indexName) => {throw new Error('unique() not supported')}, - foreign: (columns, foreignKeyName) => { - if (foreignKeyName) throw new Error('foreign(foreignKeyName) not supported') - if (Array.isArray(columns)) throw new Error('foreign([columns]) not supported') - return chinable(columns, ['foreign']) - }, - dropForeign: (columns, foreignKeyName) => {throw new Error('dropForeign() not supported')}, - dropUnique: (columns, indexName) => {throw new Error('dropUnique() not supported')}, - dropPrimary: (constraintName) => {throw new Error('dropPrimary() not supported')}, - queryContext: (context) => {throw new Error('queryContext() not supported')}, - kmigrator: (name, options) => chinable(name, ['kmigrator', options]), - } - tableCache[tableName] = table - return table -} - -(async () => { - keystone.eventHandlers = {} - await keystone.connect() - await asyncForEach(Object.values(keystone.adapters), async adapter => { - if (!adapter._createTables || !adapter.knex) { - return - } - const schemaName = adapter.schemaName - const s = adapter.schema() - const s_createTable = s.createTable - const s_table = s.table - const s_dropTableIfExists = s.dropTableIfExists - const s_dropTable = s.dropTable - s.table = s.createTable = function createTable (tableName, callback) { - const ft = createFakeTable(`${schemaName}.${tableName}`) - callback(ft) - console.log('CALL', 'createTable', tableName) - if (!adapter.listAdapters[tableName]) { - console.warn(`NO adapter.listAdapters['${tableName}']`) - console.dir(adapter.listAdapters) - } else { - for (const fad of adapter.listAdapters[tableName].fieldAdapters) { - if (fad.config.kmigratorOptions) { - ft.kmigrator(fad.path, fad.config.kmigratorOptions) - } - } - } - } - s.dropTable = s.dropTableIfExists = function dropTable (tableName) { - console.log('CALL', 'dropTable', tableName) - } - adapter.schema = () => s - const createResult = (await adapter._createTables()) - createResult.forEach((r) => { - if (r.isRejected) throw r.reason - }) - - console.log('write client config') - fs.writeFileSync(knexConnectionFile, JSON.stringify(s.client.config)) - hasKnexConnection = true - - const migrationsConfig = {directory: knexMigrationsDir} - try { - console.log('migrate.list', await adapter.knex.migrate.list(migrationsConfig)) - } catch (e) { - if (e.message.includes('no such file')) { - // await adapter.knex.migrate.make('init', migrationsConfig) - console.log('no migrations dir') - } else { - console.error(e) - process.exit(1) - } - } - }).catch((e) => { - console.error(e) - process.exit(1) - }) - if (!hasKnexConnection) { - console.error('\\nERROR: No KNEX adapter connection settings! Check the DATABASE_URL') - process.exit(3) - } - try { - fs.writeFileSync(knexSchemaFile, JSON.stringify(tableCache)) - } catch (e) { - console.error(e) - process.exit(7) - } - process.exit(0) -})() - -process.on('unhandledRejection', error => { - console.error('unhandledRejection', error) - process.exit(5) -}) -""" -RUN_KEYSTONE_KNEX_SCRIPT = """ -const entryFile = '__KEYSTONE_ENTRY_PATH__' -const knexMigrationsDir = '__KNEX_MIGRATION_DIR__' -const knexMigrationsCode = '__KNEX_MIGRATION_CODE__' - -const {asyncForEach} = require('@keystonejs/utils') -const path = require('path') -const util = require('util') -const {keystone} = require(path.resolve(entryFile)) - -async function runInContext(knex, config) { - if (knexMigrationsCode.startsWith('__')) throw new Error('internal config error: no code') - const res = await eval("(async () => {" + knexMigrationsCode + "})()") - console.log('') - console.log('RUN', JSON.stringify(knexMigrationsCode)) - console.log(' ->', res) -} - -(async () => { - keystone.eventHandlers = {} - await keystone.connect() - await asyncForEach(Object.values(keystone.adapters), async adapter => { - if (!adapter._createTables || !adapter.knex) { - return - } - const migrationsConfig = {directory: knexMigrationsDir} - try { - await runInContext(adapter.knex, migrationsConfig) - } catch (e) { - console.error(e) - process.exit(1) - } - }).catch((e) => { - console.error(e) - process.exit(1) - }) - process.exit(0) -})() -""" -DJANGO_SETTINGS_SCRIPT = """ -import json -data = json.loads('__KNEX_CONNECTION_DATA__') -SECRET_KEY = 'qn2228$&awf126b^auv%awfa*ieh)hh&^e6o!^q(zhz!l$m4' -DEBUG = True -MIDDLEWARE = [] -INSTALLED_APPS = [ - '_django_schema', -] -# ROOT_URLCONF = '_django_schema.urls' -# https://docs.djangoproject.com/en/3.0/ref/settings/#databases -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.postgresql', - 'NAME': data['connection']['database'], - 'USER': data['connection']['user'], - 'PASSWORD': data['connection']['password'], - 'HOST': data['connection']['host'], - 'PORT': data['connection']['port'] or '', - } -} -# https://docs.djangoproject.com/en/3.0/topics/i18n/ -LANGUAGE_CODE = 'en-us' -TIME_ZONE = 'UTC' -USE_I18N = True -USE_L10N = True -USE_TZ = True -""" -DJANGO_MANAGE_SCRIPT = ''' -import os -import sys -def main(): - os.environ.setdefault('DJANGO_SETTINGS_MODULE', '_django_schema.settings') - from django.core.management import execute_from_command_line - execute_from_command_line(sys.argv) -if __name__ == '__main__': - main() -''' -KNEX_MIGRATION_TPL = """// auto generated by kmigrator -// KMIGRATOR:{name}:{code} - -exports.up = async (knex) => {{ - await knex.raw(` - {fwd_sql} - `) -}} - -exports.down = async (knex) => {{ - await knex.raw(` - {bwd_sql} - `) -}} -""" -KNEX_MIGRATION_TPL_NO_DOWN = """// auto generated by kmigrator -// KMIGRATOR:{name}:{code} - -exports.up = async (knex) => {{ - await knex.raw(` - {fwd_sql} - `) -}} - -exports.down = async (knex) => {{ - throw new Error('no auto backward migration') -}} -""" - - -class KProblem(Exception): - pass - - -def _inject_ctx(data, ctx): - for k, v in ctx.items(): - data = data.replace(str(k), str(v)) - return data - - -def _1_1_prepare_cache_dir(ctx): - CACHE_DIR.mkdir(exist_ok=True) - KNEX_MIGRATIONS_DIR.mkdir(exist_ok=True) - - -def _1_2_prepare_get_knex_schema_script(ctx): - GET_KNEX_SETTINGS_SCRIPT.write_text(_inject_ctx(GET_KEYSTONE_SCHEMA_SCRIPT, ctx)) - - -def _2_1_generate_knex_jsons(ctx): - try: - log = subprocess.check_output(['node', str(GET_KNEX_SETTINGS_SCRIPT)], stderr=subprocess.STDOUT) - except subprocess.CalledProcessError as e: - log = e.output - print('ERROR: logfile =', GET_KNEX_SETTINGS_LOG.resolve()) - print(log.decode('utf-8')) - raise KProblem('ERROR: can\'t get knex schema') - finally: - GET_KNEX_SETTINGS_LOG.write_bytes(log) - ctx['__KNEX_SCHEMA_DATA__'] = Path(ctx['__KNEX_SCHEMA_PATH__']).read_text() - ctx['__KNEX_CONNECTION_DATA__'] = Path(ctx['__KNEX_CONNECTION_PATH__']).read_text() - - -def _3_1_prepare_django_dir(ctx): - DJANGO_DIR.mkdir(exist_ok=True) - migrations_dir = (DJANGO_DIR / 'migrations') - if migrations_dir.exists(): - shutil.rmtree(migrations_dir, ignore_errors=True) - migrations_dir.mkdir(exist_ok=True) - (migrations_dir / '__init__.py').write_text('') - (DJANGO_DIR / '__init__.py').write_text('') - (DJANGO_DIR / 'settings.py').write_text(_inject_ctx(DJANGO_SETTINGS_SCRIPT, ctx)) - (DJANGO_DIR / '..' / 'manage.py').write_text(DJANGO_MANAGE_SCRIPT) - (DJANGO_DIR / '..' / '_django_model_generator.py').write_text(_inject_ctx(DJANGO_MODEL_GENERATOR_SCRIPT, ctx)) - - -def _3_2_generate_django_models(ctx): - models = subprocess.check_output([sys.executable, str(DJANGO_DIR / '..' / '_django_model_generator.py')], timeout=30) - (DJANGO_DIR / 'models.py').write_bytes(models) - - -def _3_3_restore_django_migrations(ctx): - repaired = set() - for item in KNEX_MIGRATIONS_DIR.iterdir(): - if not item.is_file(): - continue - d = item.read_text() - for name, code in (re.findall(r'^// KMIGRATOR:(.*?):([A-Za-z0-9+/=]*?)$', d, re.MULTILINE)): - (DJANGO_DIR / 'migrations' / '{}.py'.format(name)).write_bytes(base64.b64decode(code.encode('ascii'))) - repaired.add(name) - ctx['__KNEX_DJANGO_MIGRATION__'] = repaired - - -def _hotfix_django_migration_bug(item): - if item.name.startswith('__'): - return - flags = re.MULTILINE | re.DOTALL - source = code = item.read_text() - deleting_models = re.findall(r'\s*migrations\.DeleteModel\(.*?name=[\'"](.*?)[\'"].*?\),', code, flags) - def _repl(x): - return x.group(0).replace('\n', '\n#') - for m in deleting_models: - (code, _) = re.subn(r'\s*migrations\.RemoveField\([^)]*?model_name=[\'"](' + m + ')[\'"][^)]*?\),', _repl, code, flags=flags) - # change DeleteModel order (reversed!) - # TODO(pahaz): probably it's not solve the delete order? - # if you see the error like: The field XXX was declared with a lazy reference to 'YYY', but app '_django_schema' doesn't provide model 'ZZZ'. - # you need to fix it here!! - delete_sections = [] - def _repl1(x): - delete_sections.append(x.group(0)) - return '' - (code_0, _) = re.subn(r'\s*migrations\.DeleteModel\([^)]*?name=[\'"](.*?)[\'"][^)]*?\),', _repl1, code, - flags=flags) - op_ind = code_0.rfind(']') - code = code_0[:op_ind].rstrip() + ''.join(reversed(delete_sections)) + '\n ]\n' - if source != code: - item.write_text(code) - - -def _4_1_makemigrations(ctx): - log_file = DJANGO_DIR / '..' / 'makemigrations.{}.log'.format(time()) - exists = ctx['__KNEX_DJANGO_MIGRATION__'] - n = datetime.now() - r = os.system(' '.join([sys.executable, str(DJANGO_DIR / '..' / 'manage.py'), 'makemigrations', '_django_schema'])) - if r != 0: - raise KProblem('ERROR: can\'t create migration') - for item in (DJANGO_DIR / 'migrations').iterdir(): - _hotfix_django_migration_bug(item) - name = item.name.replace('.py', '') - filename = '{}-{}.js'.format(n.strftime("%Y%m%d%H%M%S"), name) - if not item.is_file() or name.startswith('__') or name in exists: - continue - code = base64.b64encode(item.read_bytes()).decode('utf-8') - cmd = [sys.executable, str(DJANGO_DIR / '..' / 'manage.py'), 'sqlmigrate', '_django_schema', name] - fwd_sql = subprocess.check_output(cmd).decode('utf-8') - try: - bwd_sql = subprocess.check_output(cmd + ['--backwards'], stderr=subprocess.PIPE).decode('utf-8') - text = KNEX_MIGRATION_TPL.format(**locals()) - except subprocess.CalledProcessError as e: - print('\nWARN: !! NO BACKWARD MIGRATION !!') - print('WARN: filename={}'.format(filename)) - print('WARN: logfile={}\n'.format(log_file.resolve())) - log_file.write_bytes(e.stderr) - text = KNEX_MIGRATION_TPL_NO_DOWN.format(**locals()) - - (KNEX_MIGRATIONS_DIR / filename).write_text(text) - print(" -> ", filename) - - -def _5_1_run_knex_command(ctx, cmd='latest'): - ctx['__KNEX_MIGRATION_CODE__'] = 'return await knex.migrate.{}(config)'.format(cmd) - KNEX_MIGRATE_SCRIPT.write_text(_inject_ctx(RUN_KEYSTONE_KNEX_SCRIPT, ctx)) - log_file = DJANGO_DIR / '..' / 'knex.run.{}.{}.log'.format(time(), cmd) - try: - log = subprocess.check_output(['node', str(KNEX_MIGRATE_SCRIPT)], stderr=subprocess.STDOUT) - except subprocess.CalledProcessError as e: - log = e.output - print('ERROR: logfile =', log_file.resolve()) - raise KProblem('ERROR: can\'t run knex command knex.migrate.{}'.format(cmd)) - finally: - log_file.write_bytes(log) - print(log.decode('utf-8')) - - -def main(command, keystoneEntryFile='./index.js'): - ctx = { - '__KEYSTONE_ENTRY_PATH__': keystoneEntryFile, - '__KNEX_SCHEMA_PATH__': CACHE_DIR / 'knex.schema.json', - '__KNEX_CONNECTION_PATH__': CACHE_DIR / 'knex.connection.json', - '__KNEX_MIGRATION_DIR__': KNEX_MIGRATIONS_DIR, - } - try: - _1_1_prepare_cache_dir(ctx) - _1_2_prepare_get_knex_schema_script(ctx) - _2_1_generate_knex_jsons(ctx) - _3_1_prepare_django_dir(ctx) - _3_2_generate_django_models(ctx) - _3_3_restore_django_migrations(ctx) - if command == 'makemigrations': - _4_1_makemigrations(ctx) - elif command == 'migrate': - _5_1_run_knex_command(ctx) - elif command == 'up': - _5_1_run_knex_command(ctx, cmd='up') - elif command == 'down': - _5_1_run_knex_command(ctx, cmd='down') - elif command == 'currentVersion': - _5_1_run_knex_command(ctx, cmd='currentVersion') - elif command == 'list': - _5_1_run_knex_command(ctx, cmd='list') - except KProblem as e: - print(e, file=sys.stderr) - return 1 - - -if __name__ == '__main__': - if len(sys.argv) < 2: - print('use: kmigrator.py (makemigrations | migrate) [keystoneEntryFile]') - sys.exit(1) - sys.exit(main(*sys.argv[1:]) or 0) diff --git a/bin/run-build-all b/bin/run-build-all deleted file mode 100755 index 37465bd4..00000000 --- a/bin/run-build-all +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env node - -const fs = require('fs') -const { spawnSync } = require('child_process') - -function buildApps (apps) { - for (const app of apps) { - console.info(`MULTI-RUN: yarn workspace ${app} build`) - const child = spawnSync('yarn', ['workspace', app, 'build'], { - cwd: process.cwd(), - env: process.env, - stdio: [process.stdin, process.stdout, process.stderr], - encoding: 'utf-8', - }) - console.log(child.status) - if (child.status !== 0) { - console.error(`MULTI-RUN: ERROR! (yarn workspace ${app} build) EXIT CODE == ${child.status}`) - process.exit(child.status) - } - } -} - -function readJsonSync (path) { - return JSON.parse(fs.readFileSync(path)) -} - -function findAllBuildableApps () { - const buildable = [] - const apps = fs.readdirSync('./apps', { withFileTypes: true }) - for (const app of apps) { - const path = `./apps/${app.name}/package.json` - let pack = null - if (!app.isDirectory()) continue - if (!fs.existsSync(path)) { - console.warn(`MULTI-RUN: NO ${path} !`) - continue - } - - try { - pack = readJsonSync(path) - } catch (e) { - console.warn(`MULTI-RUN: require path ${path} error: ${e} !`) - continue - } - - if (pack.scripts && pack.scripts.build && pack.name) { - buildable.push(pack.name) - } - } - return buildable -} - -let apps = process.argv.slice(2) -if (apps.length <= 0) { - console.info('MULTI-RUN: try to find all apps with build command') - apps = findAllBuildableApps() - if (apps.length <= 0) { - console.error('MULTI-RUN: no buildable apps! Try to pass related apps paths') - console.error('USE: node ./bin/run-build-all @app/_back02keystone @app/_example05app @app/_realtime01app') - process.exit(1) - } -} - -console.info(`MULTI-RUN: run build for apps: ${apps.join(', ')}`) -buildApps(apps) diff --git a/bin/run-multiple-apps b/bin/run-multiple-apps deleted file mode 100755 index 634df51d..00000000 --- a/bin/run-multiple-apps +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env node - -const express = require('express') -const http = require('http') - -const PORT = parseInt(process.env.PORT || '3000') -let BACKENDS = [] - -function prepareAppsBackends (apps) { - BACKENDS = apps.map((m) => require(m + '/multi-app-support')) -} - -async function initApp () { - const app = express() - await Promise.all(BACKENDS.map(async (back) => { - if (!back.prepareBackApp) return - const backApp = await back.prepareBackApp() - if (!backApp) return - app.use(back.URL_PREFIX, backApp) - console.info(`MULTI-RUN: USE APP ${back.NAME} AT URL ${back.URL_PREFIX}`) - })) - return app -} - -async function startServer (port) { - const app = await initApp() - app.set('port', port) - const server = http.createServer(app) - await Promise.all(BACKENDS.map(async (back) => { - if (!back.prepareBackServer) return - await back.prepareBackServer(server) - console.info(`MULTI-RUN: PATCH SERVER BY ${back.NAME}`) - })) - return server.listen(port) -} - -const apps = process.argv.slice(2) -if (apps.length <= 0) { - console.error('MULTI-RUN: you should pass related apps paths') - console.error('USE: node ./bin/run-multiple-apps @app/_back02keystone @app/_example05app @app/_realtime01app') - process.exit(1) -} - -console.info(`MULTI-RUN: run for apps: ${apps.join(', ')}`) -prepareAppsBackends(apps) -startServer(PORT).then(() => { - console.info(`MULTI-RUN: READY on ${PORT}`) -}) diff --git a/bin/warm-docker-cache b/bin/warm-docker-cache deleted file mode 100755 index f4232303..00000000 --- a/bin/warm-docker-cache +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -rm -f -r .docker-cache-warming - -find . -type d \( -path \*/.docker-cache-warming \) -prune -o \ - -type d \( -name node_modules \) -prune -o \ - -type f \( -name "package.json" \) \ - -exec bash -c 'dest=".docker-cache-warming/$1" && \ - mkdir -p -- "$(dirname "$dest")" && \ - cp -av -- "$1" "$dest"' bash '{}' \; -# instead of mkdir + cp, you may also want to use -# rsync if it is available in your environment... diff --git a/docker-compose.yml b/docker-compose.yml index b54e6684..6ef4f7d1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,42 +1,21 @@ version: '3' services: app: - image: apps:${DOCKER_COMPOSE_APP_IMAGE_TAG:?Environment DOCKER_COMPOSE_APP_IMAGE_TAG needs to be set!} + image: apps build: context: . dockerfile: Dockerfile - args: - DOCKER_FILE_BUILD_COMMAND: ${DOCKER_FILE_BUILD_COMMAND:?Build argument DOCKER_FILE_BUILD_COMMAND needs to be set (check READEME.md)!} - DOCKER_FILE_INSTALL_COMMAND: ${DOCKER_FILE_INSTALL_COMMAND:?Build argument DOCKER_FILE_INSTALL_COMMAND needs to be set (check READEME.md)!} - ports: - - "127.0.0.1:3003:3000" - command: ${DOCKER_COMPOSE_START_APP_COMMAND:?Environment DOCKER_COMPOSE_START_APP_COMMAND needs to be set (check READEME.md)!} user: app - volumes: - - ./apps/:/home/app/apps - - ./packages/:/home/app/packages - - ./bin/:/home/app/bin - - ./package.json:/home/app/package.json - environment: - PORT: 3000 - COOKIE_SECRET: ${DOCKER_COMPOSE_COOKIE_SECRET:?Environment DOCKER_COMPOSE_COOKIE_SECRET needs to be set (check READEME.md)!} - DATABASE_URL: ${DOCKER_COMPOSE_DATABASE_URL:?Environment DOCKER_COMPOSE_DATABASE_URL needs to be set (check READEME.md)!} - SERVER_URL: ${DOCKER_COMPOSE_SERVER_URL:?Environment DOCKER_COMPOSE_SERVER_URL needs to be set (check READEME.md)!} - NODE_ENV: production networks: - app-network - mongodb: - image: mongo:4.2.5 + redis: + image: redis:7.2 ports: - - "127.0.0.1:27017:27017" - environment: - MONGO_INITDB_ROOT_USERNAME: mongo - MONGO_INITDB_ROOT_PASSWORD: mongo - MONGO_INITDB_DATABASE: main + - "127.0.0.1:6379:6379" networks: - app-network - postgresdb: - image: postgres:13.0 + postgres: + image: postgres:16.3 ports: - "127.0.0.1:5432:5432" environment: @@ -45,6 +24,11 @@ services: POSTGRES_DB: main networks: - app-network + healthcheck: + test: [ "CMD-SHELL", "pg_isready -U postgres" ] + interval: 5s + timeout: 5s + retries: 5 networks: app-network: driver: bridge diff --git a/docs/FAQ.md b/docs/FAQ.md deleted file mode 100644 index 9f81ade5..00000000 --- a/docs/FAQ.md +++ /dev/null @@ -1,31 +0,0 @@ -# Error: Cannot find module '@core/codegen' - -``` -pahaz@PahazMac16 my-new-startup $> yarn createapp -yarn run v1.22.10 -$ node ./bin/createapp -internal/modules/cjs/loader.js:983 - throw err; - ^ - -Error: Cannot find module '@core/codegen' -Require stack: -- /Users/pahaz/Code/pahaz/my-new-startup/bin/createapp - at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15) - at Function.Module._load (internal/modules/cjs/loader.js:862:27) - at Module.require (internal/modules/cjs/loader.js:1042:19) - at require (internal/modules/cjs/helpers.js:77:18) - at Object. (/Users/pahaz/Code/pahaz/my-new-startup/bin/createapp:3:23) - at Module._compile (internal/modules/cjs/loader.js:1156:30) - at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10) - at Module.load (internal/modules/cjs/loader.js:1000:32) - at Function.Module._load (internal/modules/cjs/loader.js:899:14) - at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12) { - code: 'MODULE_NOT_FOUND', - requireStack: [ '/Users/pahaz/Code/pahaz/my-new-startup/bin/createapp' ] -} -error Command failed with exit code 1. -info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. -``` - -You should run `yarn` to install dependencies and link packages workspaces. diff --git a/docs/contributing.md b/docs/contributing.md index e4861948..084a72d9 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -7,118 +7,69 @@ ## linter -We use [eslint](https://eslint.org) as our linter. It enforces code-style and best-practices - -We don't allow bad code into the repo. To ensure this we run [eslint](https://eslint.org) on `CI`. - -The configuration for the [eslint](https://eslint.org) is found under `package.json` - **Available CLI-commands:** - `yarn lint` lint whole project <- this command runs on CI - - `yarn run eslint ` check files in `` - - `yarn run eslint --fix ` check files in `` and fix them if possible - -**Editor integrations:** - -[Webstorm integration:](https://plugins.jetbrains.com/plugin/7494-eslint) - -[VSCode integration:](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) - -[Other editors](https://eslint.org/docs/user-guide/integrations#editors) - # Project features and feature requests. -Features that aren't checked are available to take - - - [x] docs: how-to create frontend app - - [x] docs: how-to write backend app - - [x] docs: how-to write mobile app - - [x] docs: how-to upgrade packages versions - - [x] docs: how-to use with postgres - - [ ] docs: how-to debug react rerenders - - [ ] docs: how-to use phone verification by firebase! - - [x] docs: how-to deploy to dokku / heroku - - [ ] docs: how-to write reusable components (mobile + web + ssr) - - [x] example: Ant Design Pro + Next.js - - [x] example: Internationalization (react-intl) - - [ ] example: Upload Attachments Antd Form - - [x] ForgotUserPassword: Schema, API, Tests - - [x] ForgotUserPassword: Page (example) - - [x] ForgotUserPassword: Email notification hook - - [ ] ForgotUserPassword: Options captcha support - - [x] ChangePassword: Schema, API, Tests - - [x] ChangePassword: Page (example) - - [x] Auth: Schema, API, Test - - [x] Auth: SignIn/SignOut Page (example) - - [x] Auth: SignIn next url support - - [x] Auth: AuthRequired component - - [x] Auth: ByPhone (API, example) - - [ ] Auth: Options captcha support - - [x] User: Schema, API, Tests - - [x] Organization: CRUD: Schema, API, Tests - - [x] Organization: CRUD: Page (example) - - [x] Organization: required to select Organization component - - [x] Organization: invite user by email: Schema, API, Tests - - [x] Organization: invite user by email for existing emails: Page (example) - - [ ] Organization: invite user by email for new emails: Page (example) - - [x] Organization: invited users list: Page (example) - - [x] Organization: bulk invite from excel file: Page (example) - - [x] Organization: accept/reject invites: Schema, API, Tests - - [x] Organization: accept/reject invites: Page (example) - - [x] User: reusable customization (like django.auth.user) - - [ ] User: unique phone/email check (for mongo/postgres)! - - [x] Register: Schema, API, Test - - [x] Register: Page (example) - - [x] Register: ByPhone (API, example) - - [ ] Register: Email verification (isEmailVerified) - - [x] Register: Phone verification (isPhoneVerified) - - [ ] Register: Extensibility (like django-registrations) - - [ ] Register: Options captcha support - - [ ] Register: Phone verification (example) - - [x] Layout: Extensible base layout - - [x] Layout: Mobile first support - - [x] Layout: FormList container (container for list of items) - - [x] Layout: FormTable container (container for table items) - - [x] Layout: Excel export container (container for exporting excel data) - - [ ] Layout: Dark mode (theme) - - [ ] Layout: Antd compatible theme example (global variables for padding/margin/colors) - - [ ] Layout: change site language widget - - [ ] docs: project structure - - [x] docs: Deploy - - [ ] docs: step by step create new project example (like Next.js, like Django app) - - [ ] UserNotifications: Schema, API, Tests - - [ ] UserNotifications: Page (example 05 top menu) - - [ ] UserProfileSettings: Schema, API, Tests - - [ ] UserProfileSettings: Page (example 05 user profile page) - - [ ] UserProfileSettings: Extensibility - - [ ] GlobalSettings: Schema, API, Tests - - [ ] GlobalSettings: Admin and example - - [ ] Core: Upload files - - [ ] Core: https://www.apollographql.com/docs/apollo-server/data/errors/ (should be the same format for strings: \[part1:field:detail]) - - [ ] Core: Realtime update support (gql Subscriptions example) https://www.apollographql.com/docs/apollo-server/data/subscriptions/ example - - [x] Core: Monorepo with packages and apps - - [x] Core: Multiple express backend support - - [x] Core: docker-compose - - [x] Core: CI Tests - - [ ] Core: CI Deploy - - [ ] Core: CI Mobile app - - [x] Core: Internationalization (react-intl) - - [x] Core: SSR (by Next.js) - - [x] Core: SSR + Apollo cache (don't query already received data) - - [x] Core: SSR + Auth (authenticate queries on the server side) - - [x] Core: SSR + Internationalization (same language as on client side) - - [ ] Core: KeystoneJS AuthProvider (with isActive check!) - - [ ] Core: isActive == false (need to kill all user sessions) - - [ ] Core: Background tasks - - [ ] Core: Background scheduled tasks - - [ ] Core: Metrics - - [ ] Core: Roles and Permissions - - [ ] Core: Logging - - [ ] Core: lerna? - - [ ] Core: benchmarks? - - [x] Core: linter - - [ ] Core: Jest + workspace + Next.js (check problems, write examples) - - Auth my social apps? (https://www.keystonejs.com/keystonejs/auth-passport/) - - CRDT example? +- [x] Monorepo: packages and apps +- [x] Monorepo: requirements tree : /packages/* and /apps/* depends on /package.json +- [x] Monorepo: reusable UI package example +- [ ] Monorepo: docs how to add app or package +- [x] TypeScript support +- [x] NextJs: init with SSR (app router) + the latest React +- [x] Antd: init Ant Design support with custom theme +- [ ] CI: run tests +- [ ] CI: test build +- [ ] CI: linters +- [ ] i18n: init internationalization support +- [ ] i18n: add Antd i18n support +- [ ] Docker: docker-compose file for deploy and local development +- [ ] Docker: docker-compose docs +- [ ] readme: local setup +- [ ] readme: overview video guide +- [ ] readme: deploy (deploy.md) +- [ ] readme: create new app (getting-started.md) +- [ ] E2E: init tests (framework?) +- [ ] Migrations: docs how to use it +- [ ] UploadFiles: Page (example) +- [ ] User: API, Tests +- [ ] Organization: API, Tests +- [ ] Organization: create Page (example) +- [ ] Organization: OrganizationRequired component +- [ ] Organization: invite user by email/phone: API, Tests +- [ ] Organization: invite user by email/phone: Page (example) +- [ ] Organization: invited users list: Page (example) +- [ ] Organization: bulk invite from excel file: Page (example) +- [ ] Organization: accept/reject invites: API, Tests +- [ ] Organization: accept/reject invites: Page (example) +- [ ] Auth: API, Test (by email/phone) +- [ ] Auth: SignIn/SignOut Page (example) +- [ ] Auth: AuthRequired component +- [ ] Auth: captcha support +- [ ] Register: API, Test (by email/phone) +- [ ] Register: Page (example) +- [ ] Register: Email/Phone verification +- [ ] Register: captcha support +- [ ] ForgotUserPassword: API, Tests +- [ ] ForgotUserPassword: Page (example) +- [ ] ForgotUserPassword: Email notification hook +- [ ] ForgotUserPassword: Options captcha support +- [ ] ChangePassword: API, Tests +- [ ] ChangePassword: Page (example) +- [ ] Permissions: API, Tests +- [ ] Permissions: Page (example) +- [ ] Layout: change site language widget +- [ ] Layout: change organization +- [ ] UserNotifications: API, Tests +- [ ] UserNotifications: Page (example from top menu) +- [ ] UserSettings: Page (example) +- [ ] Keystone: Realtime update support` +- [ ] Keystone: folder structure +- [ ] NextJs: Apollo cache +- [ ] Bull: init background tasks +- [ ] Bull: scheduled tasks +- [ ] Logging +- [ ] DX: command to add new API Schema +- [ ] DX: command to add new Web and Api app diff --git a/docs/deploy.md b/docs/deploy.md index 1377f0e4..b2ecf7d4 100644 --- a/docs/deploy.md +++ b/docs/deploy.md @@ -1,83 +1,3 @@ # Deploy -We use docker-compose to deploy your application. -You can check the `docker-compose.yml` and important variables in `.env.example` file. - -There are two important variables for building production image: - - `DOCKER_FILE_INSTALL_COMMAND` -- install extra packages and system requirements (ex: `python3 -m pip install 'psycopg2-binary>=2.8.5' && python3 -m pip install 'Django>=3.0.6'` or `apt-get -y install nano`) - - `DOCKER_FILE_BUILD_COMMAND` -- run build static or prepare some project files for production (ex: `yarn build` or `yarn workspace @app/_example05app build`) - -You can build a production docker container by `docker-compose build` command. - -There are important variables for runtime: - - `DOCKER_COMPOSE_START_APP_COMMAND` -- docker start command (ex: `yarn workspace @app/_back02keystone start`) - - `DOCKER_COMPOSE_COOKIE_SECRET` -- the keystone important variable for sessions store (ex: `AWJfbsbaf!` or some secret random string) - - `DOCKER_COMPOSE_SERVER_URL` -- the next.js important variable for API calls from frontend to backend (ex: `https://example.dok.8iq.dev`) - -That's it! - -You can build a production image localy and copy it to the production server by command: -`docker save apps:prod | bzip2 | pv | ssh root@dok.8iq.dev 'bunzip2 | docker load'` -(required `brew install pv` or just rm it from command) - -Final script should looks like: -```shell script -# 0. warm docker cache (it's speed up your rebuild) -bash ./bin/warm-docker-cache -# 1. You should build a prod image. -docker-compose build -# 2.1 Copy to prod server `docker image` -docker save apps:prod | bzip2 | pv | ssh root@dok.8iq.dev 'bunzip2 | docker load' -# 2.2 Copy to prod server `docker-compose.yml` and required `.env` -scp ./docker-compose.yml root@dok.8iq.dev:~ -scp ./.env root@dok.8iq.dev:~ -# 3. Run redeploy command -ssh root@dok.8iq.dev 'docker-compose down && docker-compose up -d' -``` - -NOTE: If you need some extra containers or you want to customize existing containers you can create -`docker-compose.override.yml` file. - -# DOKKU Deploy # - -```shell script -# Prepare dokku -dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git -dokku plugin:install https://github.com/dokku/dokku-postgres.git postgres -dokku config:set --global DOKKU_LETSENCRYPT_EMAIL=contact@8iq.dev -dokku letsencrypt:cron-job --add -``` - -```shell script -# BUILD CONTAINER LOCALY AND SEND IT TO DOKKU SERVER -export DOCKER_COMPOSE_APP_IMAGE_TAG=coddi -docker-compose build -docker save apps:${DOCKER_COMPOSE_APP_IMAGE_TAG} | bzip2 | pv | ssh root@dok.8iq.dev 'bunzip2 | docker load' -``` - -```shell script -# CREATE DOKKU APPLICATION ON DOKKU SERVER SIDE -export APP=node5 -export APP_VERSION=v5 -export DOCKER_IMAGE=apps:coddi -export START_COMMAND='yarn workspace @app/CODDI start' - -dokku apps:create ${APP} -dokku postgres:create ${APP} -dokku postgres:link ${APP} ${APP} - -dokku config:set --no-restart ${APP} NODE_ENV=production -dokku config:set --no-restart ${APP} SERVER_URL=https://${APP}.dok.8iq.dev -dokku config:set --no-restart ${APP} DOKKU_DOCKERFILE_START_CMD="${START_COMMAND}" -dokku config:set --no-restart ${APP} COOKIE_SECRET=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) -dokku checks:disable ${APP} -dokku proxy:ports-set ${APP} http:80:5000 -dokku nginx:set ${APP} hsts false -dokku nginx:set ${APP} hsts-include-subdomains false - -docker tag ${DOCKER_IMAGE} dokku/${APP}:${APP_VERSION} -dokku tags:deploy ${APP} ${APP_VERSION} -docker exec -it -u root ${APP}.web.1 yarn workspace @app/CODDI migrate - -dokku letsencrypt ${APP} -``` +TODO \ No newline at end of file diff --git a/docs/getting-started-adv.md b/docs/getting-started-adv.md deleted file mode 100644 index d7b1fbf7..00000000 --- a/docs/getting-started-adv.md +++ /dev/null @@ -1,247 +0,0 @@ -# Some advanced topics # - -## Update from 8iq repo - -```bash -# 1) Add 8iq git remote origin for easy updates -git remote add template git@github.com:8iq/nodejs-hackathon-boilerplate-starter-kit.git - -# 2) Pull changes -git pull template master --allow-unrelated-histories - -# 3) Resolve conflicts if exists (check by git status) and create merge commit -git commit -``` - -## Write Backend (Keystone.js) APP by hands - -```bash -# Create Keystone.js new backend -mkdir apps/_back01keystone - -# 1. create package.json, index.js and initial-data.js (check exampe) -# 2. define your schema by following https://www.keystonejs.com/tutorials/add-lists -# and use GQLListSchema wrappers for style checking and easy test writing - -# Link new package and Install dependencies -yarn - -# create .env file (development mode) -cat > .env << ENDOFFILE -DATABASE_URL=mongodb://mongo:mongo@127.0.0.1/main?authSource=admin -DISABLE_LOGGING=true -NODE_ENV=development -ENDOFFILE - -# Start dev server on http://localhost:3000 -yarn workspace @app/_back01keystone dev - -# Follow the Keystone.js tutorial: https://www.keystonejs.com/tutorials/add-lists -# You can run `yarn ` inside new app workspace by -# `yarn workspace @app/_back01keystone ` -``` - -## Write Frontend (Next.js) APP by hands - -```bash -# Create Next.js new React APP folder -mkdir apps/_example01app -cat > apps/_example01app/package.json << ENDOFFILE -{ - "name": "@app/_example01app", - "version": "1.0.0", - "scripts": { - "dev": "next", - "build": "next build", - "start": "next start" - }, - "dependencies": { - "isomorphic-unfetch": "^3.0.0", - "next": "^9.3.5", - "react": "^16.13.1", - "react-dom": "^16.13.1" - } -} -ENDOFFILE -mkdir apps/_example01app/pages -cat > apps/_example01app/pages/index.jsx << ENDOFFILE -function HomePage() { - return
    Welcome to Next.js!
    -} - -export default HomePage -ENDOFFILE - -# Link new package and Install dependencies -yarn - -# Start Next.js dev server on http://localhost:3000 -yarn workspace @app/_example01app dev - -# Follow the Next.js tutorial: https://nextjs.org/docs/getting-started#related -# You can run `yarn ` inside new app workspace by -# `yarn workspace @app/_example01app ` - -# You can also check `apps/_ex02front` and others examples -``` - -## Write mobile (Expo) APP by hands - -```bash -cd apps -expo init _mobile01 -cd .. -# based on https://stackoverflow.com/questions/59920012/monorepo-expo-with-yarn-workspace-and-using-expo-install -cat > apps/_mobile01/package.json << ENDOFFILE -{ - "name": "@app/_mobile01", - "version": "1.0.0", - "main": "__generated__/AppEntry.js", - "scripts": { - "start": "expo start", - "android": "expo start --android", - "ios": "expo start --ios", - "web": "expo start --web", - "eject": "expo eject", - "postinstall": "expo-yarn-workspaces postinstall" - }, - "dependencies": { - "expo": "~38.0.8", - "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-web": "~0.11.7" - }, - "devDependencies": { - "@babel/core": "^7.8.6", - "babel-preset-expo": "~8.1.0", - "expo-yarn-workspaces": "^1.2.1" - } -} -ENDOFFILE -cat > apps/_mobile01/metro.config.js << ENDOFFILE -const { createMetroConfiguration } = require("expo-yarn-workspaces"); - -module.exports = createMetroConfiguration(__dirname); -ENDOFFILE -yarn -yarn workspace @app/_mobile01 postinstall - -yarn workspace @app/_mobile01 start --clear -``` - -## Add package to existing APP - -```bash -# Add new package to APP -yarn workspace @app/_example01app add antd -``` - -## Use mongo - -You need to set `DATABASE_URL` like `mongodb://mongo:mongo@127.0.0.1/main?authSource=admin`. -Check is your database really running? or run it by docker `docker-compose up -d mongodb`. -Then, create tables. -```bash -yarn workspace @app/ex02back keystone create-tables -``` - -## Use postgresql - -You need to set `DATABASE_URL` like `postgresql://postgres:postgres@127.0.0.1/main`. -Check is your database really running? or run it by docker `docker-compose up -d postgresdb`. - -Then, create tables. -```bash -yarn workspace @app/ex02back migrate -``` - -## Postgres migrations - -https://github.com/keystonejs/keystone/discussions/3067 - -```bash -# download -curl -o kmigrator https://raw.githubusercontent.com/8iq/nodejs-hackathon-boilerplate-starter-kit/master/bin/kmigrator.py -chmod +x kmigrator -# install dependencies -python3 -m pip install django -python3 -m pip install psycopg2-binary - -# create new migrations based on the changes you have made -./kmigrator makemigrations - -# applying database migrations -./kmigrator migrate -``` - -Add to `package.json`: -```js - ... - "scripts": { - "makemigrations": "./kmigrator.py makemigrations", - "migrate": "./kmigrator.py migrate", - ... - } -``` - -Run by `yarn makemigrations` and `yarn migrate` - -## Upgrade packages versions - -```bash -# just run the command, and select packages for update (this command will fix the package.json files) -yarn upgrade-interactive --latest -``` - -## TESTS_FAKE_CLIENT_MODE - -`@core/keystone/test.utils` can work in two modes: - 1. Real client mode. Allow sending HTTP/1.1 requests to a remote server - 2. Fake client mode. Allow using fake express requests by `supertest` lib - -The Real mode is better for end-to-end testing. You can also use it to test your production. - -The Fake mode is better for debugging. Because it uses one process for the whole request/response process. -It's better for TDD like development process and to easy debug end-to-end request/response process. - -You can use `TESTS_FAKE_CLIENT_MODE` to change test mode. This option setup the express app and the fake client in one process. -This allows you to put debugger breakpoints in any part of the request/response process. -And use IDE integrations for easy debugging. - -## Debug database queries - -For postgres you can set env `DEBUG=knex:query,knex:tx`. Example: -```bash -DEBUG=knex:query,knex:tx yarn workspace @app/ex02back dev -``` - -For mongo you can set env `DEBUG_MONGOOSE=1`. Example: -```bash -DEBUG_MONGOOSE=1 yarn workspace @app/ex02back dev -``` - -## Run multiple apps at the same time - -You can use `bin/run-multiple-apps` to run more then one app. - -Example: -```bash -node ./bin/run-multiple-apps @app/ex02back @app/ex02front @app/ex03sockeio -``` - -Every app should have `multi-app-support.js` file. Check `ex02back`, `ex02front` and `ex02sockio` examples. - -## Tips - -### yarn add - - - `yarn add -W` -- add package for all apps (`yarn add react react-dom -W`) - - `yarn workspace @app/ add ` -- add package for special app (`yarn workspace @app/web add react react-dom`) - -### yarn - - - `yarn ` -- run command (`yarn dev`) - - `yarn workspace @app/ ` -- run command inside workspace (`yarn workspace @app/web dev`) - - `yarn --cwd ` -- run command inside app (`yarn --cwd apps/web dev`) diff --git a/docs/getting-started.md b/docs/getting-started.md index c8dc1510..e295e093 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -1,4 +1,4 @@ -# Init your own monorepo Fork +# Init your own monorepo You should have `docker-compose`, `git` and `node` commands. You can create a fork of [boilerplate](https://github.com/8iq/nodejs-hackathon-boilerplate-starter-kit) by click on github `Use Template` button or fork the repo. @@ -16,11 +16,4 @@ yarn # Create new application -```bash -# 4) run create app command -yarn createapp APPNAME - -# 5) follow the README quick start (check ./apps/APPNAME/ folder) -``` - -[continue to some advanced topics](getting-started-adv.md) +TODO diff --git a/docs/gists.md b/docs/gists.md deleted file mode 100644 index 369cb8e6..00000000 --- a/docs/gists.md +++ /dev/null @@ -1,139 +0,0 @@ -# some helpful code snippets - -## GQL Apollo logging plugin - -`inedx.js` -``` -const { Keystone } = require('@keystonejs/keystone') - -... - -const keystone = new Keystone({ - ... -}) - -... - -class CustomGQLPluginExample { - serverWillStart () { - console.log('Server starting!') - } - - requestDidStart (requestContext) { - console.log('GQL!o :', requestContext.operation) - console.log('GQL!op:', requestContext.request.operationName) - console.log('GQL!q :', requestContext.request.query.replace(/\n/g, '').replace(/\s+/g, ' ')) - console.log('GQL!v :', requestContext.request.variables) - console.log('GQL!u :', requestContext.context.authedItem && requestContext.context.authedItem.id) - console.log('GQL!l :', requestContext.context.authedListKey) - console.log('req!req:', requestContext.context.req) - const { req } = requestContext.context - console.log('REQ.body:', req.body) - console.log('REQ.query:', req.query) - console.log('REQ.cookies:', req.cookies) - console.log('REQ.hostname:', req.hostname) - console.log('REQ.headers:', req.headers) - console.log('REQ.rawHeaders:', req.rawHeaders) - console.log('REQ.ip:', req.ip) - console.log('REQ.ips:', req.ips) - console.log('REQ.protocol:', req.protocol) - console.log('REQ.method:', req.method) - console.log('REQ.sessionID:', req.sessionID) - console.log('REQ.id:', req.id) - console.log('REQ.originalUrl:', req.originalUrl) - console.log('REQ.url:', req.url) - console.log('Request starting!', requestContext) - } -} - -... - -module.exports = { - ..., - keystone, - apps: [ - ..., - new GraphQLApp({ - apollo: { - ..., - plugins: [new CustomGQLPluginExample()], - ..., - }, - }), - ..., - ], - ..., -} - -``` - -## Express logging plugin - -`inedx.js` -``` -const express = require('express') -const { Keystone } = require('@keystonejs/keystone') - -... - -const keystone = new Keystone({ - ... -}) - -... - -class CustomExpressPluginExample { - prepareMiddleware ({ keystone, dev, distDir }) { - const app = express() - app.use(function (req, res, next) { - console.log('Time:', Date.now()) - // console.log('REQ.body:', req.body) // doesn't work without body-parser - console.log('REQ.query:', req.query) - console.log('REQ.cookies:', req.cookies) - console.log('REQ.hostname:', req.hostname) - console.log('REQ.headers:', req.headers) - console.log('REQ.rawHeaders:', req.rawHeaders) - console.log('REQ.ip:', req.ip) - console.log('REQ.ips:', req.ips) - console.log('REQ.protocol:', req.protocol) - console.log('REQ.method:', req.method) - console.log('REQ.sessionID:', req.sessionID) - console.log('REQ.id:', req.id) - console.log('REQ.originalUrl:', req.originalUrl) - console.log('REQ.url:', req.url) - next() - }) - return app - } -} - -... - -module.exports = { - ..., - keystone, - apps: [ - ..., - new CustomExpressPluginExample(), - ..., - ], - ..., -} - -``` - -## Customize express - -`index.js` -``` -... - -module.exports = { - configureExpress: app => { - // The express application variable trust proxy must be set to support reverse proxying - app.set('trust proxy', true) - ... - }, - ... -} -``` \ No newline at end of file diff --git a/docs/index.md b/docs/index.md deleted file mode 100644 index 84150deb..00000000 --- a/docs/index.md +++ /dev/null @@ -1,11 +0,0 @@ -# Documentation - -This template based on [KeystoneJS](https://github.com/keystonejs/keystone). -KeystoneJS is just a glue between [Express](https://github.com/expressjs/express), -[ApolloGraphql](https://github.com/apollographql/), Mongoose/Knex (as ORM). - -### Contents - -* [Getting started](getting-started.md) -* [Deploy](deploy.md) -* [Contibuting](contributing.md) diff --git a/docs/links.md b/docs/links.md index 1b59653c..541ceed8 100644 --- a/docs/links.md +++ b/docs/links.md @@ -7,8 +7,7 @@ ## Server side 1. You know something about [Node.js](https://nodejs.dev/) -1. You should follow the [KeystoneJS tutorial](https://www.keystonejs.com/tutorials/new-project) -1. Something about mongo and mongoose +1. You should follow the [KeystoneJS tutorial](https://keystonejs.com/docs/getting-started) ## Client side @@ -17,7 +16,7 @@ ## More -1. yarn workspaces: https://classic.yarnpkg.com/en/docs/workspaces/ +1. yarn workspaces: https://yarnpkg.com/features/workspaces 2. CSS animations: https://css-animations.io/ (base level), https://tympanus.net/codrops/ (pro examples) 3. JS Egghead.io courses: https://egghead.io/ 4. Docker compose: https://docs.docker.com/compose/ diff --git a/package.json b/package.json index 25b08986..db141941 100644 --- a/package.json +++ b/package.json @@ -1,95 +1,23 @@ { "name": "start-up-kit", + "version": "0.0.2", "description": "Easy and Fast StartUp development kit", "private": true, - "repository": "https://github.com/pahaz/hackathon-boilerplate-starter-kit", - "homepage": "https://github.com/pahaz/hackathon-boilerplate-starter-kit", + "packageManager": "yarn@4.2.1", "license": "MIT", "workspaces": [ "apps/*", "packages/*" ], "scripts": { - "lint": "yarn run eslint .", - "createapp": "node ./bin/createapp" + "build": "turbo build", + "dev": "turbo dev", + "lint": "turbo lint", + "format": "prettier --write \"**/*.{ts,tsx,md}\"" }, "devDependencies": { - "babel-eslint": "^10.1.0", - "eslint": "^7.13.0", - "eslint-plugin-jest": "^24.1.0", - "eslint-plugin-react": "^7.21.5", - "eslint-plugin-react-hooks": "^4.2.0" + "turbo": "^1.13.3" }, - "eslintConfig": { - "env": { - "browser": true, - "es2021": true, - "node": true, - "jest/globals": true - }, - "extends": [ - "eslint:recommended", - "plugin:react/recommended", - "plugin:react-hooks/recommended" - ], - "parser": "babel-eslint", - "parserOptions": { - "ecmaFeatures": { - "jsx": true - }, - "ecmaVersion": 2019, - "sourceType": "module" - }, - "plugins": [ - "react", - "jest" - ], - "settings": { - "react": { - "version": "detect" - } - }, - "rules": { - "indent": [ - "error", - 4, - { - "SwitchCase": 1 - } - ], - "quotes": [ - "error", - "single" - ], - "semi": [ - "error", - "never" - ], - "space-before-function-paren": ["error", "always"], - "comma-dangle": ["error", { - "functions": "only-multiline", - "arrays": "always-multiline", - "imports": "always-multiline", - "exports": "always-multiline", - "objects": "always-multiline" - }], - "object-curly-spacing": ["error", "always"], - "no-prototype-builtins": "off", - "no-unused-vars": [ - "error", - { - "args": "none" - } - ], - "react/react-in-jsx-scope": "off", - "react/prop-types": "off", - "react/no-children-prop": "off", - "react/display-name": "warn", - "jest/no-disabled-tests": "warn", - "jest/no-focused-tests": "error", - "jest/no-identical-title": "error", - "jest/prefer-to-have-length": "warn", - "jest/valid-expect": "error" - } + "dependencies": { } } diff --git a/packages/@core.codegen/index.js b/packages/@core.codegen/index.js deleted file mode 100755 index f2d2ba0b..00000000 --- a/packages/@core.codegen/index.js +++ /dev/null @@ -1,109 +0,0 @@ -const chalk = require('chalk') -const boxen = require('boxen') -const yargs = require('yargs/yargs') -const fs = require('fs') -const path = require('path') -const ncp = require('ncp') -const { promisify } = require('util') -const nunjucks = require('nunjucks') -const { Readable } = require('stream') -const conf = require('@core/config') - -const DEFAULT_PROJECT_TEMPLATE = 'app00' -const access = promisify(fs.access) -const copy = promisify(ncp) - -nunjucks.configure({ autoescape: false }) - -async function streamToString (stream) { - const chunks = [] - return new Promise((resolve, reject) => { - stream.on('data', chunk => chunks.push(chunk)) - stream.on('error', reject) - stream.on('end', () => resolve(Buffer.concat(chunks).toString('utf8'))) - }) -} - -async function renderTemplates (templateDirectory, targetDirectory, templateContext) { - return copy(templateDirectory, targetDirectory, { - transform: async (readStream, writeStream, file) => { - if (['.jsx', '.js', '.json', '.ts', '.tsx', '.md'].some((x) => file.name.endsWith(x))) { - const tpl = await streamToString(readStream) - let result = tpl - try { - result = nunjucks.renderString(tpl, { ...templateContext, file: file.name }) - } catch (e) { - console.error('%s Render (%s) problem:', chalk.yellow.bold('WARN'), file.name, e) - } - - const readable = Readable.from([result]) - readable.pipe(writeStream) - } else { - readStream.pipe(writeStream) - } - }, - clobber: true, - }) -} - -async function generate (template, ctx) { - const targetDirectory = path.resolve(process.cwd(), `./apps/${ctx.name}`) - const templateDirectory = path.resolve(path.dirname(__filename), 'templates', template.toLowerCase()) - const readmeFile = path.join(targetDirectory, 'README.md') - - try { - await access(templateDirectory, fs.constants.R_OK) - } catch (err) { - console.error('%s Invalid template name', chalk.red.bold('ERROR')) - process.exit(1) - } - - await renderTemplates(templateDirectory, targetDirectory, ctx) - - console.log('%s Project ready', chalk.green.bold('DONE')) - if (fs.existsSync(readmeFile)) { - console.log('%s cat ' + readmeFile, chalk.blue.bold('The next step is:')) - } - - return true -} - -function createapp (argv) { - const args = yargs(argv) - .coerce('name', opt => { - let name = opt.toLowerCase() - if (name.length < 3) throw new Error(' is too short!') - if (!/^[a-z_][a-z0-9_]+$/.test(name)) throw new Error(' should be [a-z0-9_]+ string') - return name - }) - .usage( - '$0 ', - 'generate new application folder at apps/', - (yargs) => { - yargs.positional('name', { - describe: 'application name', - type: 'string', - }) - }, - (args) => { - const name = args.name - const greeting = chalk.white.bold(name) - const boxenOptions = { - padding: 1, - margin: 1, - borderStyle: 'round', - borderColor: 'green', - backgroundColor: '#555555', - } - const msgBox = boxen(greeting, boxenOptions) - console.log(msgBox) - generate(conf.CODEGEN_TEMPLATE || DEFAULT_PROJECT_TEMPLATE, { name }) - }, - ) - - args.parse(argv.slice(2)) -} - -module.exports = { - createapp, -} diff --git a/packages/@core.codegen/package.json b/packages/@core.codegen/package.json deleted file mode 100644 index 8a7a1343..00000000 --- a/packages/@core.codegen/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "@core/codegen", - "version": "1.0.0", - "repository": "https://github.com/pahaz/hackathon-boilerplate-starter-kit/tree/master/packages/@core.codegen", - "dependencies": { - "boxen": "^4.2.0", - "chalk": "^4.1.0", - "ncp": "^2.0.0", - "nunjucks": "^3.2.2", - "yargs": "^16.2.0" - } -} diff --git a/packages/@core.codegen/templates/app00/README.md b/packages/@core.codegen/templates/app00/README.md deleted file mode 100644 index 25344650..00000000 --- a/packages/@core.codegen/templates/app00/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# {{ name }} - -``` -cat > .env << ENDOFFILE -DATABASE_URL=postgresql://postgres:postgres@127.0.0.1/main -NODE_ENV=development -DISABLE_LOGGING=true -COOKIE_SECRET=random -SERVER_URL=http://localhost:3000 -TESTS_FAKE_CLIENT_MODE=true - -# 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=echo yarn workspace @app/{{ name }} build -DOCKER_COMPOSE_APP_IMAGE_TAG={{ name }} -DOCKER_COMPOSE_START_APP_COMMAND=yarn workspace @app/{{ name }} start -DOCKER_COMPOSE_DATABASE_URL=postgresql://postgres:postgres@postgresdb/main -DOCKER_COMPOSE_COOKIE_SECRET=random -DOCKER_COMPOSE_SERVER_URL=http://localhost:3003 -ENDOFFILE - -# up database on default port -docker-compose up -d postgresdb - -# install dependencies and link yarn workspaces -yarn - -# build first image! -bash ./bin/warm-docker-cache -docker-compose build - -# create first migration! -docker-compose run app yarn workspace @app/{{ name }} makemigrations - -# migrate! -docker-compose run app yarn workspace @app/{{ name }} migrate - -# run dev server! -yarn workspace @app/{{ name }} dev -``` - -# postgres schema migration - -``` -# create migration script at migrations/20201212124723-00xx_name.js -docker-compose run app yarn workspace @app/{{ name }} makemigrations - -# migrate current DB to new schema -docker-compose run app yarn workspace @app/{{ name }} migrate -``` diff --git a/packages/@core.codegen/templates/app00/babel.config.js b/packages/@core.codegen/templates/app00/babel.config.js deleted file mode 100644 index f1dc37a3..00000000 --- a/packages/@core.codegen/templates/app00/babel.config.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = function (api) { - api.cache(true) - return { - 'presets': ['next/babel'], - } -} diff --git a/packages/@core.codegen/templates/app00/index.js b/packages/@core.codegen/templates/app00/index.js deleted file mode 100644 index 75388c28..00000000 --- a/packages/@core.codegen/templates/app00/index.js +++ /dev/null @@ -1,63 +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'), -]) - -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, - }), - !areWeRunningTests() ? new NextApp({ dir: '.' }) : new EmptyApp(), - ], -} diff --git a/packages/@core.codegen/templates/app00/initialData.js b/packages/@core.codegen/templates/app00/initialData.js deleted file mode 100644 index 5b777d87..00000000 --- a/packages/@core.codegen/templates/app00/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/packages/@core.codegen/templates/app00/jest.config.js b/packages/@core.codegen/templates/app00/jest.config.js deleted file mode 100644 index 73f32e50..00000000 --- a/packages/@core.codegen/templates/app00/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/packages/@core.codegen/templates/app00/jest.setup.js b/packages/@core.codegen/templates/app00/jest.setup.js deleted file mode 100644 index 66767983..00000000 --- a/packages/@core.codegen/templates/app00/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/packages/@core.codegen/templates/app00/lang/en.json b/packages/@core.codegen/templates/app00/lang/en.json deleted file mode 100644 index e5951041..00000000 --- a/packages/@core.codegen/templates/app00/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/packages/@core.codegen/templates/app00/lang/ru.json b/packages/@core.codegen/templates/app00/lang/ru.json deleted file mode 100644 index ae71b53e..00000000 --- a/packages/@core.codegen/templates/app00/lang/ru.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "pages.index.PageTitle": "Демо", - "menu.Home": "Дашборд", - "menu.Users": "Пользователи", - "WeAreStillDevelopingThisPage": "Мы еще **разрабатываем** эту страницу, она пока недоступна" -} diff --git a/packages/@core.codegen/templates/app00/next.config.js b/packages/@core.codegen/templates/app00/next.config.js deleted file mode 100644 index 038f55a0..00000000 --- a/packages/@core.codegen/templates/app00/next.config.js +++ /dev/null @@ -1,20 +0,0 @@ -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` - -module.exports = withTM(withLess(withCSS({ - publicRuntimeConfig: { - // Will be available on both server and client - serverUrl, - apolloGraphQLUrl, - }, - lessLoaderOptions: { - javascriptEnabled: true, - }, -}))) diff --git a/packages/@core.codegen/templates/app00/package.json b/packages/@core.codegen/templates/app00/package.json deleted file mode 100644 index e59c2f47..00000000 --- a/packages/@core.codegen/templates/app00/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "@app/{{ name }}", - "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", - "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/{{ name }}" -} diff --git a/packages/@core.codegen/templates/app00/pages/_app.jsx b/packages/@core.codegen/templates/app00/pages/_app.jsx deleted file mode 100644 index aa64cd9f..00000000 --- a/packages/@core.codegen/templates/app00/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/packages/@core.codegen/templates/app00/pages/_document.js b/packages/@core.codegen/templates/app00/pages/_document.js deleted file mode 100644 index feefc6e8..00000000 --- a/packages/@core.codegen/templates/app00/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 ( - - - -
    - -