From a4af7ffcc291fc95b2e8cc4c613aa806f1a6a683 Mon Sep 17 00:00:00 2001 From: Puru D Date: Sat, 18 May 2024 01:44:19 -0500 Subject: [PATCH 01/14] feat: fix jobs and docker entrypoint --- .env.example | 2 +- compose.yml | 1 + docker/Dockerfile | 5 + pnpm-lock.yaml | 162 ++++++++++----------- src/instrumentation.ts | 5 +- src/jobs/auth-verification-email.ts | 2 +- src/{lib/pg-boss-base.ts => jobs/base.ts} | 5 +- src/jobs/esign-confirmation-email.ts | 2 +- src/jobs/esign-email.ts | 2 +- src/jobs/esign-pdf.ts | 2 +- src/jobs/member-inivite-email.ts | 2 +- src/jobs/password-reset-email.ts | 2 +- src/jobs/share-data-room-email.ts | 4 +- src/jobs/share-update-email.ts | 4 +- src/{lib/pg-boss-init.ts => jobs/start.ts} | 4 +- 15 files changed, 104 insertions(+), 100 deletions(-) rename src/{lib/pg-boss-base.ts => jobs/base.ts} (94%) rename src/{lib/pg-boss-init.ts => jobs/start.ts} (91%) diff --git a/.env.example b/.env.example index efc5ee0af..328d7160f 100644 --- a/.env.example +++ b/.env.example @@ -21,7 +21,7 @@ NEXT_TELEMETRY_DISABLED=1 # Prisma # https://www.prisma.io/docs/reference/database-reference/connection-urls#env -DATABASE_URL="postgres://captable:password@127.0.0.1:54321/captable" +DATABASE_URL="postgres://captable:password@pg:5432/captable" # Next Auth # You can generate a new secret on the command line with: diff --git a/compose.yml b/compose.yml index a27cfd862..bd4f2dbbb 100644 --- a/compose.yml +++ b/compose.yml @@ -7,6 +7,7 @@ services: - POSTGRES_USER=captable - POSTGRES_PASSWORD=password - POSTGRES_DB=captable + - POSTGRES_EXTENSIONS=pgcrypto ports: - 54321:5432 volumes: diff --git a/docker/Dockerfile b/docker/Dockerfile index a97e5ac36..a00b9ff01 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -63,12 +63,17 @@ COPY --from=builder --chown=nextjs:nodejs /app/scripts/migrate.sh ./scripts/migr COPY --from=builder --chown=nextjs:nodejs /app/prisma/schema.prisma ./prisma/schema.prisma COPY --from=builder --chown=nextjs:nodejs /app/prisma/migrations ./prisma/migrations + USER nextjs EXPOSE 3000 ENV PORT 3000 +# Run the migration script +RUN chmod +x ./scripts/migrate.sh +ENTRYPOINT [ "./scripts/migrate.sh" ] + # server.js is created by next build from the standalone output # https://nextjs.org/docs/pages/api-reference/next-config-js/output CMD HOSTNAME="0.0.0.0" node server.js diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c9541198f..861ebc014 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -211,7 +211,7 @@ dependencies: version: 0.0.1 sharp: specifier: ^0.33.3 - version: 0.33.3 + version: 0.33.4 superjson: specifier: ^2.2.1 version: 2.2.1 @@ -300,7 +300,7 @@ devDependencies: version: 3.4.3 tsx: specifier: ^4.7.0 - version: 4.10.2 + version: 4.10.4 typescript: specifier: ^5.4.5 version: 5.4.5 @@ -1478,9 +1478,9 @@ packages: react-dom: ^18 dependencies: '@blocknote/core': 0.12.4 - '@floating-ui/react': 0.26.14(react-dom@18.2.0)(react@18.3.1) - '@mantine/core': 7.9.1(@mantine/hooks@7.9.1)(@types/react@18.3.2)(react-dom@18.2.0)(react@18.3.1) - '@mantine/hooks': 7.9.1(react@18.3.1) + '@floating-ui/react': 0.26.15(react-dom@18.2.0)(react@18.3.1) + '@mantine/core': 7.9.2(@mantine/hooks@7.9.2)(@types/react@18.3.2)(react-dom@18.2.0)(react@18.3.1) + '@mantine/hooks': 7.9.2(react@18.3.1) '@mantine/utils': 6.0.21(react@18.3.1) '@tiptap/core': 2.4.0(@tiptap/pm@2.4.0) '@tiptap/react': 2.4.0(@tiptap/core@2.4.0)(@tiptap/pm@2.4.0)(react-dom@18.2.0)(react@18.3.1) @@ -1495,8 +1495,8 @@ packages: - supports-color dev: false - /@dot/log@0.1.3: - resolution: {integrity: sha512-Gh6enQBMuD5zxI5Rz7lNY74PnlR6K0DvavOrrSuU4uhKsUf9BgJlHyFR5or5Uu3hK8xJyfmdf0cS7rDoFD3N/A==} + /@dot/log@0.1.4: + resolution: {integrity: sha512-zymOZLqhkhJhEdU1/1odVaiTkkfMtAttpmm286yG55eReDsR43HQikJYgjv5qf4fUlE/TSKYdKFtBjkrLUjoIw==} engines: {node: '>=18'} dependencies: chalk: 4.1.2 @@ -2143,8 +2143,8 @@ packages: engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0, npm: '>=6.14.13'} dev: true - /@floating-ui/core@1.6.1: - resolution: {integrity: sha512-42UH54oPZHPdRHdw6BgoBD6cg/eVTmVrFcgeRDM3jbO7uxSoipVcmcIGFcA5jmOHO5apcyvBhkSKES3fQJnu7A==} + /@floating-ui/core@1.6.2: + resolution: {integrity: sha512-+2XpQV9LLZeanU4ZevzRnGFg2neDeKHgFLjP6YLW+tly0IvrhqT4u8enLGjLH3qeh85g19xY5rsAusfwTdn5lg==} dependencies: '@floating-ui/utils': 0.2.2 dev: false @@ -2152,14 +2152,14 @@ packages: /@floating-ui/dom@1.6.3: resolution: {integrity: sha512-RnDthu3mzPlQ31Ss/BTwQ1zjzIhr3lk1gZB1OC56h/1vEtaXkESrOqL5fQVMfXpwGtRwX+YsZBdyHtJMQnkArw==} dependencies: - '@floating-ui/core': 1.6.1 + '@floating-ui/core': 1.6.2 '@floating-ui/utils': 0.2.2 dev: false /@floating-ui/dom@1.6.5: resolution: {integrity: sha512-Nsdud2X65Dz+1RHjAIP0t8z5e2ff/IRbei6BqFrl1urT8sDVzM1HMQ+R0XcU5ceRfyO3I6ayeqIfh+6Wb8LGTw==} dependencies: - '@floating-ui/core': 1.6.1 + '@floating-ui/core': 1.6.2 '@floating-ui/utils': 0.2.2 dev: false @@ -2198,8 +2198,8 @@ packages: tabbable: 6.2.0 dev: false - /@floating-ui/react@0.26.14(react-dom@18.2.0)(react@18.3.1): - resolution: {integrity: sha512-I2EhfezC+H0WfkMEkCcF9+++PU1Wq08bDKhHHGIoBZVCciiftEQHgrSI4dTUTsa7446SiIVW0gWATliIlVNgfg==} + /@floating-ui/react@0.26.15(react-dom@18.2.0)(react@18.3.1): + resolution: {integrity: sha512-WKmfLkxTwCm09Dxq4LpjL3EPbZVSp5wvnap1jmculsfnzg2Ag/pCkP+OPyjE5dFMXqX97hsLIqJehboZ5XAHXw==} peerDependencies: react: '>=16.8.0' react-dom: '>=16.8.0' @@ -2261,8 +2261,8 @@ packages: react-hook-form: 7.51.4(react@18.3.1) dev: false - /@img/sharp-darwin-arm64@0.33.3: - resolution: {integrity: sha512-FaNiGX1MrOuJ3hxuNzWgsT/mg5OHG/Izh59WW2mk1UwYHUwtfbhk5QNKYZgxf0pLOhx9ctGiGa2OykD71vOnSw==} + /@img/sharp-darwin-arm64@0.33.4: + resolution: {integrity: sha512-p0suNqXufJs9t3RqLBO6vvrgr5OhgbWp76s5gTRvdmxmuv9E1rcaqGUsl3l4mKVmXPkTkTErXediAui4x+8PSA==} engines: {glibc: '>=2.26', node: ^18.17.0 || ^20.3.0 || >=21.0.0, npm: '>=9.6.5', pnpm: '>=7.1.0', yarn: '>=3.2.0'} cpu: [arm64] os: [darwin] @@ -2272,8 +2272,8 @@ packages: dev: false optional: true - /@img/sharp-darwin-x64@0.33.3: - resolution: {integrity: sha512-2QeSl7QDK9ru//YBT4sQkoq7L0EAJZA3rtV+v9p8xTKl4U1bUqTIaCnoC7Ctx2kCjQgwFXDasOtPTCT8eCTXvw==} + /@img/sharp-darwin-x64@0.33.4: + resolution: {integrity: sha512-0l7yRObwtTi82Z6ebVI2PnHT8EB2NxBgpK2MiKJZJ7cz32R4lxd001ecMhzzsZig3Yv9oclvqqdV93jo9hy+Dw==} engines: {glibc: '>=2.26', node: ^18.17.0 || ^20.3.0 || >=21.0.0, npm: '>=9.6.5', pnpm: '>=7.1.0', yarn: '>=3.2.0'} cpu: [x64] os: [darwin] @@ -2355,8 +2355,8 @@ packages: dev: false optional: true - /@img/sharp-linux-arm64@0.33.3: - resolution: {integrity: sha512-Zf+sF1jHZJKA6Gor9hoYG2ljr4wo9cY4twaxgFDvlG0Xz9V7sinsPp8pFd1XtlhTzYo0IhDbl3rK7P6MzHpnYA==} + /@img/sharp-linux-arm64@0.33.4: + resolution: {integrity: sha512-2800clwVg1ZQtxwSoTlHvtm9ObgAax7V6MTAB/hDT945Tfyy3hVkmiHpeLPCKYqYR1Gcmv1uDZ3a4OFwkdBL7Q==} engines: {glibc: '>=2.26', node: ^18.17.0 || ^20.3.0 || >=21.0.0, npm: '>=9.6.5', pnpm: '>=7.1.0', yarn: '>=3.2.0'} cpu: [arm64] os: [linux] @@ -2366,8 +2366,8 @@ packages: dev: false optional: true - /@img/sharp-linux-arm@0.33.3: - resolution: {integrity: sha512-Q7Ee3fFSC9P7vUSqVEF0zccJsZ8GiiCJYGWDdhEjdlOeS9/jdkyJ6sUSPj+bL8VuOYFSbofrW0t/86ceVhx32w==} + /@img/sharp-linux-arm@0.33.4: + resolution: {integrity: sha512-RUgBD1c0+gCYZGCCe6mMdTiOFS0Zc/XrN0fYd6hISIKcDUbAW5NtSQW9g/powkrXYm6Vzwd6y+fqmExDuCdHNQ==} engines: {glibc: '>=2.28', node: ^18.17.0 || ^20.3.0 || >=21.0.0, npm: '>=9.6.5', pnpm: '>=7.1.0', yarn: '>=3.2.0'} cpu: [arm] os: [linux] @@ -2377,9 +2377,9 @@ packages: dev: false optional: true - /@img/sharp-linux-s390x@0.33.3: - resolution: {integrity: sha512-vFk441DKRFepjhTEH20oBlFrHcLjPfI8B0pMIxGm3+yilKyYeHEVvrZhYFdqIseSclIqbQ3SnZMwEMWonY5XFA==} - engines: {glibc: '>=2.28', node: ^18.17.0 || ^20.3.0 || >=21.0.0, npm: '>=9.6.5', pnpm: '>=7.1.0', yarn: '>=3.2.0'} + /@img/sharp-linux-s390x@0.33.4: + resolution: {integrity: sha512-h3RAL3siQoyzSoH36tUeS0PDmb5wINKGYzcLB5C6DIiAn2F3udeFAum+gj8IbA/82+8RGCTn7XW8WTFnqag4tQ==} + engines: {glibc: '>=2.31', node: ^18.17.0 || ^20.3.0 || >=21.0.0, npm: '>=9.6.5', pnpm: '>=7.1.0', yarn: '>=3.2.0'} cpu: [s390x] os: [linux] requiresBuild: true @@ -2388,8 +2388,8 @@ packages: dev: false optional: true - /@img/sharp-linux-x64@0.33.3: - resolution: {integrity: sha512-Q4I++herIJxJi+qmbySd072oDPRkCg/SClLEIDh5IL9h1zjhqjv82H0Seupd+q2m0yOfD+/fJnjSoDFtKiHu2g==} + /@img/sharp-linux-x64@0.33.4: + resolution: {integrity: sha512-GoR++s0XW9DGVi8SUGQ/U4AeIzLdNjHka6jidVwapQ/JebGVQIpi52OdyxCNVRE++n1FCLzjDovJNozif7w/Aw==} engines: {glibc: '>=2.26', node: ^18.17.0 || ^20.3.0 || >=21.0.0, npm: '>=9.6.5', pnpm: '>=7.1.0', yarn: '>=3.2.0'} cpu: [x64] os: [linux] @@ -2399,8 +2399,8 @@ packages: dev: false optional: true - /@img/sharp-linuxmusl-arm64@0.33.3: - resolution: {integrity: sha512-qnDccehRDXadhM9PM5hLvcPRYqyFCBN31kq+ErBSZtZlsAc1U4Z85xf/RXv1qolkdu+ibw64fUDaRdktxTNP9A==} + /@img/sharp-linuxmusl-arm64@0.33.4: + resolution: {integrity: sha512-nhr1yC3BlVrKDTl6cO12gTpXMl4ITBUZieehFvMntlCXFzH2bvKG76tBL2Y/OqhupZt81pR7R+Q5YhJxW0rGgQ==} engines: {musl: '>=1.2.2', node: ^18.17.0 || ^20.3.0 || >=21.0.0, npm: '>=9.6.5', pnpm: '>=7.1.0', yarn: '>=3.2.0'} cpu: [arm64] os: [linux] @@ -2410,8 +2410,8 @@ packages: dev: false optional: true - /@img/sharp-linuxmusl-x64@0.33.3: - resolution: {integrity: sha512-Jhchim8kHWIU/GZ+9poHMWRcefeaxFIs9EBqf9KtcC14Ojk6qua7ghKiPs0sbeLbLj/2IGBtDcxHyjCdYWkk2w==} + /@img/sharp-linuxmusl-x64@0.33.4: + resolution: {integrity: sha512-uCPTku0zwqDmZEOi4ILyGdmW76tH7dm8kKlOIV1XC5cLyJ71ENAAqarOHQh0RLfpIpbV5KOpXzdU6XkJtS0daw==} engines: {musl: '>=1.2.2', node: ^18.17.0 || ^20.3.0 || >=21.0.0, npm: '>=9.6.5', pnpm: '>=7.1.0', yarn: '>=3.2.0'} cpu: [x64] os: [linux] @@ -2421,8 +2421,8 @@ packages: dev: false optional: true - /@img/sharp-wasm32@0.33.3: - resolution: {integrity: sha512-68zivsdJ0koE96stdUfM+gmyaK/NcoSZK5dV5CAjES0FUXS9lchYt8LAB5rTbM7nlWtxaU/2GON0HVN6/ZYJAQ==} + /@img/sharp-wasm32@0.33.4: + resolution: {integrity: sha512-Bmmauh4sXUsUqkleQahpdNXKvo+wa1V9KhT2pDA4VJGKwnKMJXiSTGphn0gnJrlooda0QxCtXc6RX1XAU6hMnQ==} engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0, npm: '>=9.6.5', pnpm: '>=7.1.0', yarn: '>=3.2.0'} cpu: [wasm32] requiresBuild: true @@ -2431,8 +2431,8 @@ packages: dev: false optional: true - /@img/sharp-win32-ia32@0.33.3: - resolution: {integrity: sha512-CyimAduT2whQD8ER4Ux7exKrtfoaUiVr7HG0zZvO0XTFn2idUWljjxv58GxNTkFb8/J9Ub9AqITGkJD6ZginxQ==} + /@img/sharp-win32-ia32@0.33.4: + resolution: {integrity: sha512-99SJ91XzUhYHbx7uhK3+9Lf7+LjwMGQZMDlO/E/YVJ7Nc3lyDFZPGhjwiYdctoH2BOzW9+TnfqcaMKt0jHLdqw==} engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0, npm: '>=9.6.5', pnpm: '>=7.1.0', yarn: '>=3.2.0'} cpu: [ia32] os: [win32] @@ -2440,8 +2440,8 @@ packages: dev: false optional: true - /@img/sharp-win32-x64@0.33.3: - resolution: {integrity: sha512-viT4fUIDKnli3IfOephGnolMzhz5VaTvDRkYqtZxOMIoMQ4MrAziO7pT1nVnOt2FAm7qW5aa+CCc13aEY6Le0g==} + /@img/sharp-win32-x64@0.33.4: + resolution: {integrity: sha512-3QLocdTRVIrFNye5YocZl+KKpYKP+fksi1QhmOArgx7GyhIbQp/WrJRu176jm8IxromS7RIkzMiMINVdBtC8Aw==} engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0, npm: '>=9.6.5', pnpm: '>=7.1.0', yarn: '>=3.2.0'} cpu: [x64] os: [win32] @@ -2595,15 +2595,15 @@ packages: call-bind: 1.0.7 dev: true - /@mantine/core@7.9.1(@mantine/hooks@7.9.1)(@types/react@18.3.2)(react-dom@18.2.0)(react@18.3.1): - resolution: {integrity: sha512-UXK11t1fAQ2ROQ9HTIZfyU52XdwS8sFJ2SRUh5uHMWSahJo3wTdKzaCvYN7wg+ONM9p6ENT0hC0dfv5qXoKU4w==} + /@mantine/core@7.9.2(@mantine/hooks@7.9.2)(@types/react@18.3.2)(react-dom@18.2.0)(react@18.3.1): + resolution: {integrity: sha512-ARNEiREF70tikW6at8QwFFcDbtennPjnhPOifaDL1sQurO3ORN/iOUFxiH1npWoqNydUZHxhsfFVpte8NNf/oQ==} peerDependencies: - '@mantine/hooks': 7.9.1 + '@mantine/hooks': 7.9.2 react: ^18.2.0 react-dom: ^18.2.0 dependencies: - '@floating-ui/react': 0.26.14(react-dom@18.2.0)(react@18.3.1) - '@mantine/hooks': 7.9.1(react@18.3.1) + '@floating-ui/react': 0.26.15(react-dom@18.2.0)(react@18.3.1) + '@mantine/hooks': 7.9.2(react@18.3.1) clsx: 2.1.0 react: 18.3.1 react-dom: 18.2.0(react@18.3.1) @@ -2615,8 +2615,8 @@ packages: - '@types/react' dev: false - /@mantine/hooks@7.9.1(react@18.3.1): - resolution: {integrity: sha512-nb2Ar+2HfGxLjGZgObapeUeqcQsUWJ+rvj4X2KNTUy3+YpvLIMD3CqREowWHF7/5OTGh4BCyBqQNZ9JFpnMeHQ==} + /@mantine/hooks@7.9.2(react@18.3.1): + resolution: {integrity: sha512-qT8vvHZ8K/qFXSSIyq/NHpKgtEs1Vas4Z2tPPtMTN7oyibjsel09XebPAt59nkJS/SACQbja0GZ4lUXI2+AFFw==} peerDependencies: react: ^18.2.0 dependencies: @@ -5086,11 +5086,11 @@ packages: /@types/lodash-es@4.17.12: resolution: {integrity: sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==} dependencies: - '@types/lodash': 4.17.1 + '@types/lodash': 4.17.4 dev: true - /@types/lodash@4.17.1: - resolution: {integrity: sha512-X+2qazGS3jxLAIz5JDXDzglAF3KpijdhFxlf/V1+hEsOUc+HnWi81L/uv/EvGuV90WY+7mPGFCUDGfQC3Gj95Q==} + /@types/lodash@4.17.4: + resolution: {integrity: sha512-wYCP26ZLxaT3R39kiN2+HcJ4kTd3U1waI/cY7ivWYqFP6pW3ZNpvi6Wd6PHZx7T/t8z0vlkXMg3QYLa7DZ/IJQ==} dev: true /@types/mdast@3.0.15: @@ -6021,7 +6021,7 @@ packages: postcss: ^8.1.0 dependencies: browserslist: 4.23.0 - caniuse-lite: 1.0.30001618 + caniuse-lite: 1.0.30001620 fraction.js: 4.3.7 normalize-range: 0.1.2 picocolors: 1.0.1 @@ -6185,8 +6185,8 @@ packages: engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001618 - electron-to-chromium: 1.4.769 + caniuse-lite: 1.0.30001620 + electron-to-chromium: 1.4.774 node-releases: 2.0.14 update-browserslist-db: 1.0.16(browserslist@4.23.0) @@ -6236,8 +6236,8 @@ packages: resolution: {integrity: sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==} engines: {node: '>= 6'} - /caniuse-lite@1.0.30001618: - resolution: {integrity: sha512-p407+D1tIkDvsEAPS22lJxLQQaG8OTBEqo0KhzfABGk0TU4juBNDSfH0hyAp/HRyx+M8L17z/ltyhxh27FTfQg==} + /caniuse-lite@1.0.30001620: + resolution: {integrity: sha512-WJvYsOjd1/BYUY6SNGUosK9DUidBPDTnOARHp3fSmFO1ekdxaY6nKRttEVrfMmYi80ctS0kz1wiWmm14fVc3ew==} /canvas@2.11.2: resolution: {integrity: sha512-ItanGBMrmRV7Py2Z+Xhs7cT+FNt5K0vPL4p9EZ/UX/Mu7hFbkxSjKF2KVtPwX7UYWp7dRKnrTvReflgrItJbdw==} @@ -6937,8 +6937,8 @@ packages: jake: 10.9.1 dev: true - /electron-to-chromium@1.4.769: - resolution: {integrity: sha512-bZu7p623NEA2rHTc9K1vykl57ektSPQYFFqQir8BOYf6EKOB+yIsbFB9Kpm7Cgt6tsLr9sRkqfqSZUw7LP1XxQ==} + /electron-to-chromium@1.4.774: + resolution: {integrity: sha512-132O1XCd7zcTkzS3FgkAzKmnBuNJjK8WjcTtNuoylj7MYbqw5eXehjQ5OK91g0zm7OTKIPeaAG4CPoRfD9M1Mg==} /elliptic@6.5.5: resolution: {integrity: sha512-7EjbcmUm17NQFu4Pmgmq2olYMj8nwMnpcddByChSUjArp8F5DQWcIcpriwO4ZToLNAJig0yiyjswfyGNje/ixw==} @@ -8204,7 +8204,7 @@ packages: '@jsx-email/app-preview': ^1.2.6 react: ^18.2.0 dependencies: - '@dot/log': 0.1.3 + '@dot/log': 0.1.4 '@jsx-email/app-preview': 1.2.6(@types/node@20.12.12)(@types/react-dom@18.3.0)(@types/react@18.3.2)(react@18.3.1) '@jsx-email/doiuse-email': 1.0.1 '@jsx-email/minify-preset': 1.0.1 @@ -8281,8 +8281,8 @@ packages: resolution: {integrity: sha512-y+SqErxb8h7nE/fiEX07jsbuhrpO9lL8eca7/Y1nuWV2moNlXhyd59iDGcRf6moVyDMbmTNzL40SUyrFU/yDpg==} dev: false - /lib0@0.2.93: - resolution: {integrity: sha512-M5IKsiFJYulS+8Eal8f+zAqf5ckm1vffW0fFDxfgxJ+uiVopvDdd3PxJmz0GsVi3YNO7QCFSq0nAsiDmNhLj9Q==} + /lib0@0.2.94: + resolution: {integrity: sha512-hZ3p54jL4Wpu7IOg26uC7dnEWiMyNlUrb9KoG7+xYs45WkQwpVvKFndVq2+pqLYKe1u8Fp3+zAfZHVvTK34PvQ==} engines: {node: '>=16'} hasBin: true dependencies: @@ -9080,8 +9080,8 @@ packages: nodemailer: 6.9.13 oauth: 0.9.15 openid-client: 5.6.5 - preact: 10.21.0 - preact-render-to-string: 5.2.6(preact@10.21.0) + preact: 10.22.0 + preact-render-to-string: 5.2.6(preact@10.22.0) react: 18.3.1 react-dom: 18.2.0(react@18.3.1) uuid: 8.3.2 @@ -9124,7 +9124,7 @@ packages: '@next/env': 14.2.3 '@swc/helpers': 0.5.5 busboy: 1.6.0 - caniuse-lite: 1.0.30001618 + caniuse-lite: 1.0.30001620 graceful-fs: 4.2.11 postcss: 8.4.31 react: 18.3.1 @@ -9797,17 +9797,17 @@ packages: xtend: 4.0.2 dev: false - /preact-render-to-string@5.2.6(preact@10.21.0): + /preact-render-to-string@5.2.6(preact@10.22.0): resolution: {integrity: sha512-JyhErpYOvBV1hEPwIxc/fHWXPfnEGdRKxc8gFdAZ7XV4tlzyzG847XAyEZqoDnynP88akM4eaHcSOzNcLWFguw==} peerDependencies: preact: '>=10' dependencies: - preact: 10.21.0 + preact: 10.22.0 pretty-format: 3.8.0 dev: false - /preact@10.21.0: - resolution: {integrity: sha512-aQAIxtzWEwH8ou+OovWVSVNlFImL7xUCwJX3YMqA3U8iKCNC34999fFOnWjYNsylgfPgMexpbk7WYOLtKr/mxg==} + /preact@10.22.0: + resolution: {integrity: sha512-RRurnSjJPj4rp5K6XoP45Ui33ncb7e4H7WiOHVpjbkvqvA3U+N8Z6Qbo0AE6leGYBV66n8EhEaFixvIu3SkxFw==} dev: false /pretty-bytes@5.6.0: @@ -10820,8 +10820,8 @@ packages: safe-buffer: 5.2.1 dev: false - /sharp@0.33.3: - resolution: {integrity: sha512-vHUeXJU1UvlO/BNwTpT0x/r53WkLUVxrmb5JTgW92fdFCFk0ispLMAeu/jPO2vjkXM1fYUi3K7/qcLF47pwM1A==} + /sharp@0.33.4: + resolution: {integrity: sha512-7i/dt5kGl7qR4gwPRD2biwD2/SvBn3O04J77XKFgL2OnZtQw+AG9wnuS/csmu80nPRHLYE9E41fyEiG8nhH6/Q==} engines: {libvips: '>=8.15.2', node: ^18.17.0 || ^20.3.0 || >=21.0.0} requiresBuild: true dependencies: @@ -10829,8 +10829,8 @@ packages: detect-libc: 2.0.3 semver: 7.6.2 optionalDependencies: - '@img/sharp-darwin-arm64': 0.33.3 - '@img/sharp-darwin-x64': 0.33.3 + '@img/sharp-darwin-arm64': 0.33.4 + '@img/sharp-darwin-x64': 0.33.4 '@img/sharp-libvips-darwin-arm64': 1.0.2 '@img/sharp-libvips-darwin-x64': 1.0.2 '@img/sharp-libvips-linux-arm': 1.0.2 @@ -10839,15 +10839,15 @@ packages: '@img/sharp-libvips-linux-x64': 1.0.2 '@img/sharp-libvips-linuxmusl-arm64': 1.0.2 '@img/sharp-libvips-linuxmusl-x64': 1.0.2 - '@img/sharp-linux-arm': 0.33.3 - '@img/sharp-linux-arm64': 0.33.3 - '@img/sharp-linux-s390x': 0.33.3 - '@img/sharp-linux-x64': 0.33.3 - '@img/sharp-linuxmusl-arm64': 0.33.3 - '@img/sharp-linuxmusl-x64': 0.33.3 - '@img/sharp-wasm32': 0.33.3 - '@img/sharp-win32-ia32': 0.33.3 - '@img/sharp-win32-x64': 0.33.3 + '@img/sharp-linux-arm': 0.33.4 + '@img/sharp-linux-arm64': 0.33.4 + '@img/sharp-linux-s390x': 0.33.4 + '@img/sharp-linux-x64': 0.33.4 + '@img/sharp-linuxmusl-arm64': 0.33.4 + '@img/sharp-linuxmusl-x64': 0.33.4 + '@img/sharp-wasm32': 0.33.4 + '@img/sharp-win32-ia32': 0.33.4 + '@img/sharp-win32-x64': 0.33.4 dev: false /shebang-command@2.0.0: @@ -11314,8 +11314,8 @@ packages: /tslib@2.6.2: resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} - /tsx@4.10.2: - resolution: {integrity: sha512-gOfACgv1ElsIjvt7Fp0rMJKGnMGjox0JfGOfX3kmZCV/yZumaNqtHGKBXt1KgaYS9KjDOmqGeI8gHk/W7kWVZg==} + /tsx@4.10.4: + resolution: {integrity: sha512-Gtg9qnZWNqC/OtcgiXfoAUdAKx3/cgKOYvEocAsv+m21MV/eKpV/WUjRXe6/sDCaGBl2/v8S6v29BpUnGMCX5A==} engines: {node: '>=18.0.0'} hasBin: true dependencies: @@ -11839,7 +11839,7 @@ packages: y-protocols: ^1.0.1 yjs: ^13.5.38 dependencies: - lib0: 0.2.93 + lib0: 0.2.94 prosemirror-model: 1.21.0 prosemirror-state: 1.4.3 prosemirror-view: 1.33.6 @@ -11852,7 +11852,7 @@ packages: peerDependencies: yjs: ^13.0.0 dependencies: - lib0: 0.2.93 + lib0: 0.2.94 yjs: 13.6.15 /y18n@5.0.8: @@ -11899,7 +11899,7 @@ packages: resolution: {integrity: sha512-moFv4uNYhp8BFxIk3AkpoAnnjts7gwdpiG8RtyFiKbMtxKCS0zVZ5wPaaGpwC3V2N/K8TK8MwtSI3+WO9CHWjQ==} engines: {node: '>=16.0.0', npm: '>=8.0.0'} dependencies: - lib0: 0.2.93 + lib0: 0.2.94 /yocto-queue@0.1.0: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} diff --git a/src/instrumentation.ts b/src/instrumentation.ts index 2912343e8..58e6c77cd 100644 --- a/src/instrumentation.ts +++ b/src/instrumentation.ts @@ -1,7 +1,6 @@ export async function register() { if (process.env.NEXT_RUNTIME === "nodejs") { - const { initPgBoss } = await import("./lib/pg-boss-init"); - - await initPgBoss(); + const { startJobs } = await import("@/jobs/start"); + await startJobs(); } } diff --git a/src/jobs/auth-verification-email.ts b/src/jobs/auth-verification-email.ts index 88ef59850..94bcdc2e2 100644 --- a/src/jobs/auth-verification-email.ts +++ b/src/jobs/auth-verification-email.ts @@ -1,6 +1,6 @@ import AccountVerificationEmail from "@/emails/AccountVerificationEmail"; import { env } from "@/env"; -import { BaseJob } from "@/lib/pg-boss-base"; +import { BaseJob } from "@/jobs/base"; import { sendMail } from "@/server/mailer"; import { render } from "jsx-email"; import type { Job } from "pg-boss"; diff --git a/src/lib/pg-boss-base.ts b/src/jobs/base.ts similarity index 94% rename from src/lib/pg-boss-base.ts rename to src/jobs/base.ts index a000f9516..0b0334c07 100644 --- a/src/lib/pg-boss-base.ts +++ b/src/jobs/base.ts @@ -1,9 +1,8 @@ -import { JOB_TYPES } from "@/constants/job"; +import type { JOB_TYPES } from "@/constants/job"; import { env } from "@/env"; +import { singleton } from "@/lib/singleton"; import pgBoss from "pg-boss"; -import { singleton } from "./singleton"; - type JobTypes = typeof JOB_TYPES; export type JobType = { diff --git a/src/jobs/esign-confirmation-email.ts b/src/jobs/esign-confirmation-email.ts index ce7386d21..aacfc6bb1 100644 --- a/src/jobs/esign-confirmation-email.ts +++ b/src/jobs/esign-confirmation-email.ts @@ -1,5 +1,5 @@ import ESignConfirmationEmail from "@/emails/EsignConfirmationEmail"; -import { BaseJob } from "@/lib/pg-boss-base"; +import { BaseJob } from "@/jobs/base"; import { sendMail } from "@/server/mailer"; import { render } from "jsx-email"; import type { Job } from "pg-boss"; diff --git a/src/jobs/esign-email.ts b/src/jobs/esign-email.ts index a5ca6a58a..2fd5cb711 100644 --- a/src/jobs/esign-email.ts +++ b/src/jobs/esign-email.ts @@ -1,6 +1,6 @@ import EsignEmail from "@/emails/EsignEmail"; import { env } from "@/env"; -import { BaseJob } from "@/lib/pg-boss-base"; +import { BaseJob } from "@/jobs/base"; import { db } from "@/server/db"; import { sendMail } from "@/server/mailer"; import { render } from "jsx-email"; diff --git a/src/jobs/esign-pdf.ts b/src/jobs/esign-pdf.ts index b002c6692..869623650 100644 --- a/src/jobs/esign-pdf.ts +++ b/src/jobs/esign-pdf.ts @@ -1,4 +1,4 @@ -import { BaseJob } from "@/lib/pg-boss-base"; +import { BaseJob } from "@/jobs/base"; import { db } from "@/server/db"; import { type EsignGetTemplateType, diff --git a/src/jobs/member-inivite-email.ts b/src/jobs/member-inivite-email.ts index 7e275caaa..2086a1989 100644 --- a/src/jobs/member-inivite-email.ts +++ b/src/jobs/member-inivite-email.ts @@ -1,7 +1,7 @@ import MemberInviteEmail from "@/emails/MemberInviteEmail"; import { env } from "@/env"; +import { BaseJob } from "@/jobs/base"; import { constants } from "@/lib/constants"; -import { BaseJob } from "@/lib/pg-boss-base"; import { sendMail } from "@/server/mailer"; import { render } from "jsx-email"; import type { Job } from "pg-boss"; diff --git a/src/jobs/password-reset-email.ts b/src/jobs/password-reset-email.ts index a1939039b..f01d049fa 100644 --- a/src/jobs/password-reset-email.ts +++ b/src/jobs/password-reset-email.ts @@ -1,6 +1,6 @@ import PasswordResetEmail from "@/emails/PasswordResetEmail"; import { env } from "@/env"; -import { BaseJob } from "@/lib/pg-boss-base"; +import { BaseJob } from "@/jobs/base"; import { sendMail } from "@/server/mailer"; import { render } from "jsx-email"; import type { Job } from "pg-boss"; diff --git a/src/jobs/share-data-room-email.ts b/src/jobs/share-data-room-email.ts index 8528092bb..b71b2cfd9 100644 --- a/src/jobs/share-data-room-email.ts +++ b/src/jobs/share-data-room-email.ts @@ -1,8 +1,8 @@ import ShareDataRoomEmail from "@/emails/ShareDataRoomEmail"; -import { BaseJob } from "@/lib/pg-boss-base"; +import { BaseJob } from "@/jobs/base"; import { sendMail } from "@/server/mailer"; import { render } from "jsx-email"; -import { Job } from "pg-boss"; +import type { Job } from "pg-boss"; export type DataRoomEmailPayloadType = { link: string; diff --git a/src/jobs/share-update-email.ts b/src/jobs/share-update-email.ts index 355448228..f229dd0a7 100644 --- a/src/jobs/share-update-email.ts +++ b/src/jobs/share-update-email.ts @@ -1,8 +1,8 @@ import ShareUpdateEmail from "@/emails/ShareUpdateEmail"; -import { BaseJob } from "@/lib/pg-boss-base"; +import { BaseJob } from "@/jobs/base"; import { sendMail } from "@/server/mailer"; import { render } from "jsx-email"; -import { Job } from "pg-boss"; +import type { Job } from "pg-boss"; export type UpdateSharePayloadType = { update: { diff --git a/src/lib/pg-boss-init.ts b/src/jobs/start.ts similarity index 91% rename from src/lib/pg-boss-init.ts rename to src/jobs/start.ts index 65c3372a6..4126116f8 100644 --- a/src/lib/pg-boss-init.ts +++ b/src/jobs/start.ts @@ -1,4 +1,5 @@ import { AuthVerificationEmailJob } from "@/jobs/auth-verification-email"; +import { JobManager, boss } from "@/jobs/base"; import { EsignConfirmationEmailJob } from "@/jobs/esign-confirmation-email"; import { EsignNotificationEmailJob } from "@/jobs/esign-email"; import { EsignPdfJob } from "@/jobs/esign-pdf"; @@ -6,9 +7,8 @@ import { SendMemberInviteEmailJob } from "@/jobs/member-inivite-email"; import { PasswordResetEmailJob } from "@/jobs/password-reset-email"; import { ShareDataRoomEmailJob } from "@/jobs/share-data-room-email"; import { ShareUpdateEmailJob } from "@/jobs/share-update-email"; -import { JobManager, boss } from "./pg-boss-base"; -export async function initPgBoss() { +export async function startJobs() { const jobs = new JobManager(boss) .register(AuthVerificationEmailJob) .register(ShareUpdateEmailJob) From a8ce6f89f9488d6024b11959a8d9ac772e221142 Mon Sep 17 00:00:00 2001 From: Puru D Date: Sun, 19 May 2024 03:57:48 -0500 Subject: [PATCH 02/14] feat: fix some env variables --- .env.example | 29 +++-------- .gitpod.yml | 1 - SELF-HOSTING.md | 50 ++++++++++++++++++- docker/Dockerfile | 1 - src/common/uploads.ts | 8 +-- src/env.js | 36 ------------- src/jobs/auth-verification-email.ts | 2 +- src/jobs/esign-email.ts | 2 +- src/jobs/member-inivite-email.ts | 2 +- src/jobs/password-reset-email.ts | 2 +- src/lib/authenticator.ts | 4 +- src/trpc/routers/data-room-router/router.ts | 5 +- .../routers/update/procedures/share-update.ts | 4 +- src/trpc/shared.ts | 9 ++-- 14 files changed, 72 insertions(+), 83 deletions(-) diff --git a/.env.example b/.env.example index 328d7160f..c73c01da1 100644 --- a/.env.example +++ b/.env.example @@ -12,22 +12,16 @@ # Next.js environment variables NODE_ENV="development" NEXT_PUBLIC_NODE_ENV="development" -BASE_URL="http://localhost:3000" NEXT_PUBLIC_BASE_URL="http://localhost:3000" -# Next.js collects completely anonymous telemetry data about general usage. Learn more here: https://nextjs.org/telemetry -# Uncomment the following line to disable telemetry at run time -NEXT_TELEMETRY_DISABLED=1 +# Disable telemetry at run time +NEXT_TELEMETRY_DISABLED=1 # Injected in Dockerfile # Prisma -# https://www.prisma.io/docs/reference/database-reference/connection-urls#env DATABASE_URL="postgres://captable:password@pg:5432/captable" # Next Auth -# You can generate a new secret on the command line with: -# https://next-auth.js.org/configuration/options#secret - -# openssl rand -base64 32 +# Run `openssl rand -base64 32` to generate a new secret NEXTAUTH_SECRET="xxxxxxxxxx" NEXTAUTH_URL="http://localhost:3000" @@ -36,24 +30,13 @@ GOOGLE_CLIENT_ID="xxxxxxxxxx" GOOGLE_CLIENT_SECRET="xxxxxxxxxx" # SMTP -EMAIL_SERVER_HOST="localhost" -EMAIL_SERVER_PORT=1025 -EMAIL_SERVER_USERNAME="captable" -EMAIL_SERVER_PASSWORD="password" -EMAIL_SERVER_SECURE=0 -# EMAIL_SERVER=smtp://captable:password@127.0.0.1:2500 -EMAIL_FROM=hello@cap.new +EMAIL_FROM="'Captable, Inc.' " +EMAIL_SERVER=smtp://captable:password@127.0.0.1:2500 # Uploads -UPLOAD_PROVIDER="s3" UPLOAD_ENDPOINT="http://127.0.0.1:9002" -NEXT_PUBLIC_UPLOAD_DOMAIN="http://127.0.0.1:9002" - -# value should be 'auto' while using r2 -UPLOAD_REGION="us-east-1" +UPLOAD_REGION="us-east-1" # value should be 'auto' while using r2 UPLOAD_ACCESS_KEY_ID="captable" UPLOAD_SECRET_ACCESS_KEY="password" - UPLOAD_BUCKET_PUBLIC="captable-public-bucket" UPLOAD_BUCKET_PRIVATE="captable-private-bucket" - diff --git a/.gitpod.yml b/.gitpod.yml index ee9b96c67..0a51253bc 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -3,7 +3,6 @@ tasks: pnpm install && cp .env.example .env && export NEXTAUTH_SECRET="$(openssl rand -base64 32)" && - export BASE_URL="$(gp url 3000)" && export NEXT_PUBLIC_BASE_URL="$(gp url 3000)" && export EMAIL_SERVER_PORT=2500 command: pnpm db:migrate && pnpm dx diff --git a/SELF-HOSTING.md b/SELF-HOSTING.md index d67621d0e..4c34ce89c 100644 --- a/SELF-HOSTING.md +++ b/SELF-HOSTING.md @@ -14,4 +14,52 @@ If you like to self-host Captable, Inc., please schedule a call with us, and we - **Official Docker Images**: - Docker hub - - Github registry + + +- **Environment Variables**:\ +Following envrionment variables are required + +```bash +NODE_ENV="production" +DATABASE_URL="postgres://user:password@host:port/dbname" +NEXTAUTH_SECRET="xxx" # Generated by `openssl rand -base64 32` +NEXTAUTH_URL="https://your-domain.com" +NEXT_PUBLIC_BASE_URL="https://your-domain.com" + +# Email server environment variables +EMAIL_FROM="your@email.com" +EMAIL_SERVER="smtp://username:password@host:port" + +# File uplod environment variables +UPLOAD_REGION="us-west-1" # auto when using Cloudflare R2 +UPLOAD_ENDPOINT="https://xxx.r2.cloudflarestorage.com" +UPLOAD_ACCESS_KEY_ID="xxx" +UPLOAD_SECRET_ACCESS_KEY="xxx" +UPLOAD_BUCKET_PUBLIC="public-bucket-name" +UPLOAD_BUCKET_PRIVATE="private-bucket-name" +``` + +- **Setup CORS for file uploads**:\ + Some of the services including Cloudflare R2 may require you to setup CORS for file uploads.\ + + > Here is an sample CORS configuration for Cloudflare R2. + +```json +[ + { + "AllowedOrigins": [ + "https://your-domain.com" + ], + "AllowedMethods": [ + "HEAD", + "GET", + "POST", + "PUT", + "DELETE" + ], + "AllowedHeaders": [ + "*" + ] + } +] +``` \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile index a00b9ff01..608dbebd8 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -39,7 +39,6 @@ FROM base AS runner WORKDIR /app ENV NODE_ENV production -# Uncomment the following line in case you want to disable telemetry during runtime. ENV NEXT_TELEMETRY_DISABLED 1 ENV DOCKER_OUTPUT 1 diff --git a/src/common/uploads.ts b/src/common/uploads.ts index 1d20ae2db..80c0d574e 100644 --- a/src/common/uploads.ts +++ b/src/common/uploads.ts @@ -3,7 +3,6 @@ import { getPresignedPutUrl, type getPresignedUrlOptions, } from "@/server/file-uploads"; -import { env } from "next-runtime-env"; /** * usage * ```js @@ -47,12 +46,7 @@ export const uploadFile = async ( } const { name, type, size } = file; - let fileUrl = bucketUrl; - - const uploadDomain = env("NEXT_PUBLIC_UPLOAD_DOMAIN"); - if (bucketMode === "publicBucket" && uploadDomain) { - fileUrl = `${uploadDomain}/${key}`; - } + const fileUrl = bucketUrl; return { key, diff --git a/src/env.js b/src/env.js index 2fa6cf5f7..efbd84191 100644 --- a/src/env.js +++ b/src/env.js @@ -1,26 +1,12 @@ import { createEnv } from "@t3-oss/env-nextjs"; import { z } from "zod"; -// https://env.t3.gg/docs/recipes#booleans -const COERCED_BOOLEAN = z - .string() - // transform to boolean using preferred coercion logic - .transform((s) => s !== "false" && s !== "0"); - -// const ONLY_BOOLEAN = z -// .string() -// // only allow "true" or "false" -// .refine((s) => s === "true" || s === "false") -// // transform to boolean -// .transform((s) => s === "true"); - export const env = createEnv({ /** * Specify your server-side environment variables schema here. This way you can ensure the app * isn't built with invalid env vars. */ server: { - BASE_URL: z.string().url(), DATABASE_URL: z .string() .url() @@ -36,25 +22,13 @@ export const env = createEnv({ EMAIL_SERVER: z.string().optional(), EMAIL_FROM: z.string(), - /// smtp - - EMAIL_SERVER_HOST: z.string(), - EMAIL_SERVER_PORT: z.coerce.number(), - EMAIL_SERVER_SECURE: COERCED_BOOLEAN, - EMAIL_SERVER_USERNAME: z.string().optional(), - EMAIL_SERVER_PASSWORD: z.string().optional(), - - //flags - // upload - UPLOAD_ENDPOINT: z.string(), UPLOAD_REGION: z.string(), UPLOAD_BUCKET_PUBLIC: z.string(), UPLOAD_BUCKET_PRIVATE: z.string(), UPLOAD_ACCESS_KEY_ID: z.string().optional(), UPLOAD_SECRET_ACCESS_KEY: z.string().optional(), - UPLOAD_PROVIDER: z.enum(["s3", "r2"]), // google GOOGLE_CLIENT_ID: z.string().optional(), @@ -70,7 +44,6 @@ export const env = createEnv({ // NEXT_PUBLIC_CLIENTVAR: z.string(), NEXT_PUBLIC_BASE_URL: z.string(), NEXT_PUBLIC_NODE_ENV: z.string().default("development"), - NEXT_PUBLIC_UPLOAD_DOMAIN: z.string().optional(), }, /** @@ -79,7 +52,6 @@ export const env = createEnv({ */ runtimeEnv: { NODE_ENV: process.env.NODE_ENV, - BASE_URL: process.env.BASE_URL, NEXT_PUBLIC_BASE_URL: process.env.NEXT_PUBLIC_BASE_URL, NEXT_PUBLIC_NODE_ENV: process.env.NEXT_PUBLIC_NODE_ENV, DATABASE_URL: process.env.DATABASE_URL, @@ -88,20 +60,12 @@ export const env = createEnv({ EMAIL_SERVER: process.env.EMAIL_SERVER, EMAIL_FROM: process.env.EMAIL_FROM, - EMAIL_SERVER_HOST: process.env.EMAIL_SERVER_HOST, - EMAIL_SERVER_PORT: process.env.EMAIL_SERVER_PORT, - EMAIL_SERVER_SECURE: process.env.EMAIL_SERVER_SECURE, - EMAIL_SERVER_USERNAME: process.env.EMAIL_SERVER_USERNAME, - EMAIL_SERVER_PASSWORD: process.env.EMAIL_SERVER_PASSWORD, - UPLOAD_ENDPOINT: process.env.UPLOAD_ENDPOINT, UPLOAD_REGION: process.env.UPLOAD_REGION, UPLOAD_BUCKET_PUBLIC: process.env.UPLOAD_BUCKET_PUBLIC, UPLOAD_BUCKET_PRIVATE: process.env.UPLOAD_BUCKET_PRIVATE, UPLOAD_ACCESS_KEY_ID: process.env.UPLOAD_ACCESS_KEY_ID, UPLOAD_SECRET_ACCESS_KEY: process.env.UPLOAD_SECRET_ACCESS_KEY, - UPLOAD_PROVIDER: process.env.UPLOAD_PROVIDER, - NEXT_PUBLIC_UPLOAD_DOMAIN: process.env.NEXT_PUBLIC_UPLOAD_DOMAIN, GOOGLE_CLIENT_ID: process.env.GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET: process.env.GOOGLE_CLIENT_SECRET, diff --git a/src/jobs/auth-verification-email.ts b/src/jobs/auth-verification-email.ts index 94bcdc2e2..7ae583aa8 100644 --- a/src/jobs/auth-verification-email.ts +++ b/src/jobs/auth-verification-email.ts @@ -14,7 +14,7 @@ export const sendAuthVerificationEmail = async ( payload: AuthVerificationPayloadType, ) => { const { email, token } = payload; - const baseUrl = env.BASE_URL; + const baseUrl = env.NEXT_PUBLIC_BASE_URL; const confirmLink = `${baseUrl}/verify-email/${token}`; diff --git a/src/jobs/esign-email.ts b/src/jobs/esign-email.ts index 2fd5cb711..32e27bae9 100644 --- a/src/jobs/esign-email.ts +++ b/src/jobs/esign-email.ts @@ -34,7 +34,7 @@ export type ExtendedEsignPayloadType = EsignEmailPayloadType & export const sendEsignEmail = async (payload: ExtendedEsignPayloadType) => { const { email, token, ...rest } = payload; - const baseUrl = env.BASE_URL; + const baseUrl = env.NEXT_PUBLIC_BASE_URL; const html = await render( EsignEmail({ signingLink: `${baseUrl}/esign/${token}`, diff --git a/src/jobs/member-inivite-email.ts b/src/jobs/member-inivite-email.ts index 2086a1989..b275b142f 100644 --- a/src/jobs/member-inivite-email.ts +++ b/src/jobs/member-inivite-email.ts @@ -25,7 +25,7 @@ export const sendMemberInviteEmail = async ( ) => { const { email, token, verificationToken, company, user } = payload; - const baseUrl = env.BASE_URL; + const baseUrl = env.NEXT_PUBLIC_BASE_URL; const callbackUrl = `${baseUrl}/verify-member/${verificationToken}`; const params = new URLSearchParams({ diff --git a/src/jobs/password-reset-email.ts b/src/jobs/password-reset-email.ts index f01d049fa..92cb3e3a2 100644 --- a/src/jobs/password-reset-email.ts +++ b/src/jobs/password-reset-email.ts @@ -14,7 +14,7 @@ export const sendPasswordResetEmail = async ( payload: PasswordResetPayloadType, ) => { const { email, token } = payload; - const baseUrl = env.BASE_URL; + const baseUrl = env.NEXT_PUBLIC_BASE_URL; const confirmLink = `${baseUrl}/reset-password/${token}`; diff --git a/src/lib/authenticator.ts b/src/lib/authenticator.ts index 2e756734a..8a608acf1 100644 --- a/src/lib/authenticator.ts +++ b/src/lib/authenticator.ts @@ -5,13 +5,13 @@ import { env } from "@/env"; * Extracts common fields to identify the RP (relying party) */ export const getAuthenticatorOptions = () => { - const webAppBaseUrl = new URL(env.BASE_URL); + const webAppBaseUrl = new URL(env.NEXT_PUBLIC_BASE_URL); const rpId = webAppBaseUrl.hostname; return { rpName: "Captable", rpId, - origin: env.BASE_URL, + origin: env.NEXT_PUBLIC_BASE_URL, timeout: PASSKEY_TIMEOUT, }; }; diff --git a/src/trpc/routers/data-room-router/router.ts b/src/trpc/routers/data-room-router/router.ts index ebd3ff46e..5d667e91b 100644 --- a/src/trpc/routers/data-room-router/router.ts +++ b/src/trpc/routers/data-room-router/router.ts @@ -168,6 +168,7 @@ export const dataRoomRouter = createTRPCRouter({ data: room, }; } catch (error) { + console.error(error); return { success: false, message: @@ -207,7 +208,7 @@ export const dataRoomRouter = createTRPCRouter({ const company = dataRoom.company; const upsertManyRecipients = async () => { - const baseUrl = env.BASE_URL; + const baseUrl = env.NEXT_PUBLIC_BASE_URL; const recipients = [...others, ...selectedContacts]; for (const recipient of recipients) { @@ -251,7 +252,7 @@ export const dataRoomRouter = createTRPCRouter({ const link = `${baseUrl}/data-rooms/${dataRoom.publicId}?token=${token}`; const payload: DataRoomEmailPayloadType = { - senderName: senderName!, + senderName: `${senderName}`, recipientName: recipient.name, companyName: company.name, dataRoom: dataRoom.name, diff --git a/src/trpc/routers/update/procedures/share-update.ts b/src/trpc/routers/update/procedures/share-update.ts index edcb8847e..b48b8c7a5 100644 --- a/src/trpc/routers/update/procedures/share-update.ts +++ b/src/trpc/routers/update/procedures/share-update.ts @@ -39,7 +39,7 @@ export const shareUpdateProcedure = withAuth const company = update.company; const upsertManyRecipients = async () => { - const baseUrl = env.BASE_URL; + const baseUrl = env.NEXT_PUBLIC_BASE_URL; const recipients = [...others, ...selectedContacts]; for (const recipient of recipients) { @@ -84,7 +84,7 @@ export const shareUpdateProcedure = withAuth const link = `${baseUrl}/updates/${update.publicId}?token=${token}`; const payload: UpdateSharePayloadType = { - senderName: senderName!, + senderName: `${senderName}`, recipientName: recipient.name, companyName: company.name, update: { diff --git a/src/trpc/shared.ts b/src/trpc/shared.ts index 68ac9b1c5..d0638e007 100644 --- a/src/trpc/shared.ts +++ b/src/trpc/shared.ts @@ -1,17 +1,18 @@ -import { type inferRouterInputs, type inferRouterOutputs } from "@trpc/server"; +import type { inferRouterInputs, inferRouterOutputs } from "@trpc/server"; import superjson from "superjson"; -import { type AppRouter } from "@/trpc/api/root"; +import type { AppRouter } from "@/trpc/api/root"; export const transformer = superjson; function getBaseUrl() { if (typeof window !== "undefined") return ""; - return process.env.BASE_URL; + return process.env.NEXT_PUBLIC_BASE_URL; } export function getUrl() { - return getBaseUrl() + "/api/trpc"; + const baseUrl = getBaseUrl(); + return `${baseUrl}/api/trpc`; } /** From 4f662fa4a91b0b0fed28c57faee78eaca5134967 Mon Sep 17 00:00:00 2001 From: Puru D Date: Sun, 19 May 2024 03:59:08 -0500 Subject: [PATCH 03/14] chore: dubug mode --- .github/workflows/release.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 82e89b249..fbfcc7066 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,8 +1,11 @@ name: Production on: - release: - types: [published] + # release: + # types: [published] + push: + branches: + - debug jobs: push_to_registries: @@ -58,6 +61,6 @@ jobs: version: latest - name: 🚀 Deploy Production - run: flyctl deploy --remote-only --image captable/captable:latest + run: flyctl deploy --remote-only --image captable/captable:debug env: FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} From d2ef842e72a25d8936b6e11ffe4b770af33236d1 Mon Sep 17 00:00:00 2001 From: Puru D Date: Sun, 19 May 2024 04:08:14 -0500 Subject: [PATCH 04/14] feat: replace createTransport config with EMAIL_SERVER --- src/server/mailer.ts | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/server/mailer.ts b/src/server/mailer.ts index df1f678f9..72e54b6a4 100644 --- a/src/server/mailer.ts +++ b/src/server/mailer.ts @@ -7,21 +7,8 @@ import { env } from "@/env"; import { type SendMailOptions, createTransport } from "nodemailer"; const getTransport = () => { - if (env.EMAIL_SERVER) { - return createTransport(env.EMAIL_SERVER); - } - return createTransport({ - host: env.EMAIL_SERVER_HOST, - port: env.EMAIL_SERVER_PORT, - secure: env.EMAIL_SERVER_SECURE, - ...(env.EMAIL_SERVER_PASSWORD && - env.EMAIL_SERVER_USERNAME && { - auth: { - user: env.EMAIL_SERVER_USERNAME, - pass: env.EMAIL_SERVER_PASSWORD, - }, - }), + url: env.EMAIL_SERVER, }); }; From b8db5cda1aa1c9cac3bf211d4f3a80853d4f7134 Mon Sep 17 00:00:00 2001 From: Puru D Date: Sun, 19 May 2024 04:16:01 -0500 Subject: [PATCH 05/14] chore: disable running migration - for now --- docker/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 608dbebd8..4e63f20ea 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -70,8 +70,8 @@ EXPOSE 3000 ENV PORT 3000 # Run the migration script -RUN chmod +x ./scripts/migrate.sh -ENTRYPOINT [ "./scripts/migrate.sh" ] +# RUN chmod +x ./scripts/migrate.sh +# ENTRYPOINT [ "./scripts/migrate.sh" ] # server.js is created by next build from the standalone output # https://nextjs.org/docs/pages/api-reference/next-config-js/output From fb761b42b215652b3fc904ccd150a3caaf6bbdc7 Mon Sep 17 00:00:00 2001 From: Puru D Date: Sun, 19 May 2024 04:28:32 -0500 Subject: [PATCH 06/14] feat: update self-hosting documentation --- SELF-HOSTING.md | 38 +++++++++++++++++++++++++++++++++++++- fly.toml | 2 +- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/SELF-HOSTING.md b/SELF-HOSTING.md index 4c34ce89c..9d92015a4 100644 --- a/SELF-HOSTING.md +++ b/SELF-HOSTING.md @@ -39,6 +39,27 @@ UPLOAD_BUCKET_PUBLIC="public-bucket-name" UPLOAD_BUCKET_PRIVATE="private-bucket-name" ``` +- **Run the docker container**: + +```bash +docker run -d \ + -e NODE_ENV="replace" \ + -e DATABASE_URL="replace" \ + -e NEXTAUTH_SECRET="replace" \ + -e NEXTAUTH_URL="replace" \ + -e NEXT_PUBLIC_BASE_URL="replace" \ + -e EMAIL_FROM="replace" \ + -e EMAIL_SERVER="replace" \ + -e UPLOAD_REGION="replace" \ + -e UPLOAD_ENDPOINT="replace" \ + -e UPLOAD_ACCESS_KEY_ID="replace" \ + -e UPLOAD_SECRET_ACCESS_KEY="replace" \ + -e UPLOAD_BUCKET_PUBLIC="replace" \ + -e UPLOAD_BUCKET_PRIVATE="replace" \ + -p 3000:3000 \ + captable/captable +``` + - **Setup CORS for file uploads**:\ Some of the services including Cloudflare R2 may require you to setup CORS for file uploads.\ @@ -62,4 +83,19 @@ UPLOAD_BUCKET_PRIVATE="private-bucket-name" ] } ] -``` \ No newline at end of file +``` + +- **Run database migrations**: + +```bash +docker exec -it npx prisma migrate deploy +``` + + +- **Access the application**:\ + Open your browser and navigate to `https://your-domain.com` + +- **Questions?**\ + If you have any questions, please schedule a call with us, and we will help you set up your own instance. + + Book us diff --git a/fly.toml b/fly.toml index c57e88bae..e7c2f2557 100644 --- a/fly.toml +++ b/fly.toml @@ -26,7 +26,7 @@ cpus = 1 [deploy] strategy = "canary" -release_command = "sh ./scripts/migrate.sh" +# release_command = "sh ./scripts/migrate.sh" [env] NODE_ENV = "production" From 0325db700753c9bdb5da99bc86aa150c7ef6c1c5 Mon Sep 17 00:00:00 2001 From: Puru D Date: Sun, 19 May 2024 04:35:03 -0500 Subject: [PATCH 07/14] feat: cleanup all migrations --- .../migration.sql | 111 --- .../migration.sql | 60 -- .../migration.sql | 10 - .../migration.sql | 18 - .../20240121190638_audit/migration.sql | 11 - .../migration.sql | 11 - .../migration.sql | 12 - .../migration.sql | 5 - .../migrations/20240124024329_/migration.sql | 32 - .../migration.sql | 2 - .../migration.sql | 2 - .../migration.sql | 2 - .../migration.sql | 2 - .../migration.sql | 57 -- .../migration.sql | 17 - .../migration.sql | 12 - .../migration.sql | 12 - .../migration.sql | 13 - .../migration.sql | 2 - .../migration.sql | 2 - .../migration.sql | 4 - .../migration.sql | 2 - .../migration.sql | 20 - .../migration.sql | 10 - .../migration.sql | 76 -- .../migration.sql | 128 --- .../migration.sql | 15 - .../migration.sql | 123 --- .../migration.sql | 14 - .../20240217135154_remove_order/migration.sql | 8 - .../migration.sql | 14 - .../migration.sql | 28 - .../migration.sql | 8 - .../migration.sql | 20 - .../20240218235419_update_enums/migration.sql | 34 - .../migrations/20240219002354_/migration.sql | 25 - .../migration.sql | 53 -- .../migration.sql | 24 - .../migration.sql | 10 - .../migration.sql | 24 - .../migration.sql | 8 - .../migration.sql | 13 - .../migration.sql | 8 - .../20240305033321_create_share/migration.sql | 50 -- .../migration.sql | 52 -- .../migration.sql | 14 - .../migration.sql | 108 --- .../migration.sql | 8 - .../migration.sql | 8 - .../migration.sql | 26 - .../migration.sql | 2 - .../migration.sql | 15 - .../migration.sql | 10 - .../migration.sql | 2 - .../migration.sql | 47 - .../migration.sql | 8 - .../migration.sql | 9 - .../migration.sql | 34 - .../migration.sql | 8 - .../migration.sql | 2 - .../migration.sql | 9 - .../migration.sql | 12 - .../migration.sql | 13 - .../migration.sql | 9 - .../migration.sql | 10 - .../migration.sql | 8 - .../migration.sql | 2 - .../20240412204835_add_dataroom/migration.sql | 52 -- .../migration.sql | 2 - .../migration.sql | 8 - .../migration.sql | 5 - .../migration.sql | 2 - .../migration.sql | 8 - .../migration.sql | 2 - .../migration.sql | 28 - .../migration.sql | 29 - .../migration.sql | 14 - .../migration.sql | 2 - .../migration.sql | 2 - .../20240501122457_esign_logs/migration.sql | 25 - .../migration.sql | 2 - .../migration.sql | 2 - .../migration.sql | 2 - .../20240505021110_add_select/migration.sql | 2 - .../migration.sql | 2 - .../migration.sql | 34 - .../migration.sql | 62 -- .../migration.sql | 2 - .../migration.sql | 5 - .../migration.sql | 827 ++++++++++++++++++ 90 files changed, 827 insertions(+), 1820 deletions(-) delete mode 100644 prisma/migrations/20240110184601_add_waitlistuser/migration.sql delete mode 100644 prisma/migrations/20240113061544_company_and_associated_schema_changes/migration.sql delete mode 100644 prisma/migrations/20240114024759_add_onboarding_fields/migration.sql delete mode 100644 prisma/migrations/20240117213425_add_invited_email/migration.sql delete mode 100644 prisma/migrations/20240121190638_audit/migration.sql delete mode 100644 prisma/migrations/20240123073934_add_company_association_for_audit/migration.sql delete mode 100644 prisma/migrations/20240123080419_add_public_field_for_company/migration.sql delete mode 100644 prisma/migrations/20240123095815_remove_userid_unique_from_membership/migration.sql delete mode 100644 prisma/migrations/20240124024329_/migration.sql delete mode 100644 prisma/migrations/20240126184544_update_migration/migration.sql delete mode 100644 prisma/migrations/20240126192007_idx_member_status/migration.sql delete mode 100644 prisma/migrations/20240126203821_missing_migration/migration.sql delete mode 100644 prisma/migrations/20240203065505_add_summary_for_audit/migration.sql delete mode 100644 prisma/migrations/20240204035614_add_share_class_and_equity_plan/migration.sql delete mode 100644 prisma/migrations/20240206030218_fix_invite_migration/migration.sql delete mode 100644 prisma/migrations/20240206032010_add_missing_migration/migration.sql delete mode 100644 prisma/migrations/20240206042707_update_share_class_conversion_rights/migration.sql delete mode 100644 prisma/migrations/20240206230113_update_share_class_migration/migration.sql delete mode 100644 prisma/migrations/20240207035312_optional_converts_to_share_class_id/migration.sql delete mode 100644 prisma/migrations/20240208060046_add_plan_effective_date/migration.sql delete mode 100644 prisma/migrations/20240208062212_convert_comments_to_string/migration.sql delete mode 100644 prisma/migrations/20240208081440_add_work_email/migration.sql delete mode 100644 prisma/migrations/20240213070600_create_document/migration.sql delete mode 100644 prisma/migrations/20240214010015_replace_document_url_with_key/migration.sql delete mode 100644 prisma/migrations/20240214190435_modify_document_schema/migration.sql delete mode 100644 prisma/migrations/20240215144007_add_bucket_and_template_models/migration.sql delete mode 100644 prisma/migrations/20240215153900_add_new_fields/migration.sql delete mode 100644 prisma/migrations/20240216224520_update_db_schema_and_enums/migration.sql delete mode 100644 prisma/migrations/20240217134858_rename_position_field/migration.sql delete mode 100644 prisma/migrations/20240217135154_remove_order/migration.sql delete mode 100644 prisma/migrations/20240217170744_change_data_type/migration.sql delete mode 100644 prisma/migrations/20240218214308_add_team_table/migration.sql delete mode 100644 prisma/migrations/20240218215510_add_title_to_team/migration.sql delete mode 100644 prisma/migrations/20240218230234_update_team_schema/migration.sql delete mode 100644 prisma/migrations/20240218235419_update_enums/migration.sql delete mode 100644 prisma/migrations/20240219002354_/migration.sql delete mode 100644 prisma/migrations/20240219083043_rename_membership_to_member/migration.sql delete mode 100644 prisma/migrations/20240222042734_add_stakeholder/migration.sql delete mode 100644 prisma/migrations/20240226162609_add_new_viewport_field/migration.sql delete mode 100644 prisma/migrations/20240227052735_create_investment_table/migration.sql delete mode 100644 prisma/migrations/20240228095749_add_page_field/migration.sql delete mode 100644 prisma/migrations/20240301064354_update_stakeholder/migration.sql delete mode 100644 prisma/migrations/20240304075022_remove_waitlist_table/migration.sql delete mode 100644 prisma/migrations/20240305033321_create_share/migration.sql delete mode 100644 prisma/migrations/20240305040106_create_options/migration.sql delete mode 100644 prisma/migrations/20240305040535_update_option_types/migration.sql delete mode 100644 prisma/migrations/20240306212205_add_convertibles/migration.sql delete mode 100644 prisma/migrations/20240313161813_added_grant_id_in_options/migration.sql delete mode 100644 prisma/migrations/20240314200619_unique_grant_id_per_company/migration.sql delete mode 100644 prisma/migrations/20240316044930_add_safe_templates/migration.sql delete mode 100644 prisma/migrations/20240316054731_make_post_money_default/migration.sql delete mode 100644 prisma/migrations/20240316062444_support_custom_safe_template/migration.sql delete mode 100644 prisma/migrations/20240317081008_add_default_value_and_read_only/migration.sql delete mode 100644 prisma/migrations/20240319052020_add_default_country/migration.sql delete mode 100644 prisma/migrations/20240321052430_create_updates/migration.sql delete mode 100644 prisma/migrations/20240321061035_add_html_to_updates/migration.sql delete mode 100644 prisma/migrations/20240321063823_rename_public_to_is_public/migration.sql delete mode 100644 prisma/migrations/20240321064350_rename_updates_to_update/migration.sql delete mode 100644 prisma/migrations/20240322062022_make_public_id_uniq/migration.sql delete mode 100644 prisma/migrations/20240323033041_add_company_logo/migration.sql delete mode 100644 prisma/migrations/20240331065543_update_shared_at_to_sent_at/migration.sql delete mode 100644 prisma/migrations/20240401072542_update_status_enum/migration.sql delete mode 100644 prisma/migrations/20240402041757_add_document_share/migration.sql delete mode 100644 prisma/migrations/20240402050447_change_recipients_column_in_document_share/migration.sql delete mode 100644 prisma/migrations/20240402050900_change_expires_at_to_link_expires_at_share_document/migration.sql delete mode 100644 prisma/migrations/20240407064117_add_public_id_to_document_share_table/migration.sql delete mode 100644 prisma/migrations/20240412090141_add_missing_index/migration.sql delete mode 100644 prisma/migrations/20240412204835_add_dataroom/migration.sql delete mode 100644 prisma/migrations/20240414050202_add_website_to_company/migration.sql delete mode 100644 prisma/migrations/20240414052328_make_data_room_name_uniq_for_a_company/migration.sql delete mode 100644 prisma/migrations/20240414065518_add_member_to_data_room/migration.sql delete mode 100644 prisma/migrations/20240416074225_data_room_created_timestamp/migration.sql delete mode 100644 prisma/migrations/20240416221402_uniq_data_room_documents/migration.sql delete mode 100644 prisma/migrations/20240416221945_make_expires_at_optional/migration.sql delete mode 100644 prisma/migrations/20240421083719_implement_email_password_login_feature/migration.sql delete mode 100644 prisma/migrations/20240427153534_improve_esign_workflow/migration.sql delete mode 100644 prisma/migrations/20240430070047_update_data_room_recipient/migration.sql delete mode 100644 prisma/migrations/20240430070149_make_name_optional/migration.sql delete mode 100644 prisma/migrations/20240501052622_index_public_id/migration.sql delete mode 100644 prisma/migrations/20240501122457_esign_logs/migration.sql delete mode 100644 prisma/migrations/20240503082232_index_id_and_dataroomid/migration.sql delete mode 100644 prisma/migrations/20240504055008_optional_recipient/migration.sql delete mode 100644 prisma/migrations/20240504130551_add_message_column_at_template/migration.sql delete mode 100644 prisma/migrations/20240505021110_add_select/migration.sql delete mode 100644 prisma/migrations/20240507010943_add_meta_field/migration.sql delete mode 100644 prisma/migrations/20240507044842_re_create_update_recipient/migration.sql delete mode 100644 prisma/migrations/20240512165126_passkey_setup/migration.sql delete mode 100644 prisma/migrations/20240513040603_make_user_id_optional_in_verification_token_model/migration.sql delete mode 100644 prisma/migrations/20240513073506_add_missing_index/migration.sql create mode 100644 prisma/migrations/20240519093430_clean_migration/migration.sql diff --git a/prisma/migrations/20240110184601_add_waitlistuser/migration.sql b/prisma/migrations/20240110184601_add_waitlistuser/migration.sql deleted file mode 100644 index 85da2ad4e..000000000 --- a/prisma/migrations/20240110184601_add_waitlistuser/migration.sql +++ /dev/null @@ -1,111 +0,0 @@ --- CreateEnum -CREATE TYPE "AccessEnum" AS ENUM ('READ', 'WRITE', 'ADMIN'); - --- CreateTable -CREATE TABLE "Account" ( - "id" TEXT NOT NULL, - "userId" TEXT NOT NULL, - "type" TEXT NOT NULL, - "provider" TEXT NOT NULL, - "providerAccountId" TEXT NOT NULL, - "refresh_token" TEXT, - "access_token" TEXT, - "expires_at" INTEGER, - "token_type" TEXT, - "scope" TEXT, - "id_token" TEXT, - "session_state" TEXT, - - CONSTRAINT "Account_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "Session" ( - "id" TEXT NOT NULL, - "sessionToken" TEXT NOT NULL, - "userId" TEXT NOT NULL, - "expires" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "Session_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "User" ( - "id" TEXT NOT NULL, - "name" TEXT, - "email" TEXT, - "emailVerified" TIMESTAMP(3), - "image" TEXT, - - CONSTRAINT "User_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "WaitlistUser" ( - "id" TEXT NOT NULL, - "email" TEXT NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "WaitlistUser_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "VerificationToken" ( - "identifier" TEXT NOT NULL, - "token" TEXT NOT NULL, - "expires" TIMESTAMP(3) NOT NULL -); - --- CreateTable -CREATE TABLE "Org" ( - "id" TEXT NOT NULL, - "name" TEXT NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "Org_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "Member" ( - "id" TEXT NOT NULL, - "title" TEXT, - "access" "AccessEnum" NOT NULL DEFAULT 'READ', - "active" BOOLEAN NOT NULL DEFAULT true, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - "userId" TEXT, - "orgId" TEXT, - - CONSTRAINT "Member_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE INDEX "Account_userId_idx" ON "Account"("userId"); - --- CreateIndex -CREATE UNIQUE INDEX "Account_provider_providerAccountId_key" ON "Account"("provider", "providerAccountId"); - --- CreateIndex -CREATE UNIQUE INDEX "Session_sessionToken_key" ON "Session"("sessionToken"); - --- CreateIndex -CREATE INDEX "Session_userId_idx" ON "Session"("userId"); - --- CreateIndex -CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); - --- CreateIndex -CREATE UNIQUE INDEX "WaitlistUser_email_key" ON "WaitlistUser"("email"); - --- CreateIndex -CREATE UNIQUE INDEX "VerificationToken_token_key" ON "VerificationToken"("token"); - --- CreateIndex -CREATE UNIQUE INDEX "VerificationToken_identifier_token_key" ON "VerificationToken"("identifier", "token"); - --- CreateIndex -CREATE INDEX "Member_orgId_idx" ON "Member"("orgId"); - --- CreateIndex -CREATE UNIQUE INDEX "Member_userId_orgId_key" ON "Member"("userId", "orgId"); diff --git a/prisma/migrations/20240113061544_company_and_associated_schema_changes/migration.sql b/prisma/migrations/20240113061544_company_and_associated_schema_changes/migration.sql deleted file mode 100644 index 1d5763790..000000000 --- a/prisma/migrations/20240113061544_company_and_associated_schema_changes/migration.sql +++ /dev/null @@ -1,60 +0,0 @@ -/* - Warnings: - - - You are about to drop the `Member` table. If the table is not empty, all the data it contains will be lost. - - You are about to drop the `Org` table. If the table is not empty, all the data it contains will be lost. - -*/ --- CreateEnum -CREATE TYPE "MEMBERHIP_STATUS" AS ENUM ('PENDING', 'ACCEPTED', 'DECLINED'); - --- CreateEnum -CREATE TYPE "MEMBERSHIP_ACCESS" AS ENUM ('READ', 'WRITE', 'ADMIN'); - --- DropTable -DROP TABLE "Member"; - --- DropTable -DROP TABLE "Org"; - --- DropEnum -DROP TYPE "AccessEnum"; - --- CreateTable -CREATE TABLE "Company" ( - "id" TEXT NOT NULL, - "name" TEXT NOT NULL, - "incorporationType" TEXT NOT NULL, - "incorporationDate" TIMESTAMP(3) NOT NULL, - "incorporationCountry" TEXT NOT NULL, - "incorporationState" TEXT NOT NULL, - "streetAddress" TEXT NOT NULL, - "city" TEXT NOT NULL, - "state" TEXT NOT NULL, - "zipcode" TEXT NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "Company_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "Membership" ( - "id" TEXT NOT NULL, - "title" TEXT, - "active" BOOLEAN NOT NULL DEFAULT true, - "status" "MEMBERHIP_STATUS" NOT NULL DEFAULT 'PENDING', - "access" "MEMBERSHIP_ACCESS" NOT NULL DEFAULT 'READ', - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - "userId" TEXT, - "companyId" TEXT, - - CONSTRAINT "Membership_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE INDEX "Membership_companyId_idx" ON "Membership"("companyId"); - --- CreateIndex -CREATE UNIQUE INDEX "Membership_userId_companyId_key" ON "Membership"("userId", "companyId"); diff --git a/prisma/migrations/20240114024759_add_onboarding_fields/migration.sql b/prisma/migrations/20240114024759_add_onboarding_fields/migration.sql deleted file mode 100644 index 8bb9a45da..000000000 --- a/prisma/migrations/20240114024759_add_onboarding_fields/migration.sql +++ /dev/null @@ -1,10 +0,0 @@ -/* - Warnings: - - - Made the column `companyId` on table `Membership` required. This step will fail if there are existing NULL values in that column. - -*/ --- AlterTable -ALTER TABLE "Membership" ADD COLUMN "isOnboarded" BOOLEAN NOT NULL DEFAULT false, -ADD COLUMN "lastAccessed" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, -ALTER COLUMN "companyId" SET NOT NULL; diff --git a/prisma/migrations/20240117213425_add_invited_email/migration.sql b/prisma/migrations/20240117213425_add_invited_email/migration.sql deleted file mode 100644 index 05ced1a77..000000000 --- a/prisma/migrations/20240117213425_add_invited_email/migration.sql +++ /dev/null @@ -1,18 +0,0 @@ -/* - Warnings: - - - A unique constraint covering the columns `[companyId,invitedEmail]` on the table `Membership` will be added. If there are existing duplicate values, this will fail. - - A unique constraint covering the columns `[userId]` on the table `Membership` will be added. If there are existing duplicate values, this will fail. - -*/ --- DropIndex -DROP INDEX "Membership_userId_companyId_key"; - --- AlterTable -ALTER TABLE "Membership" ADD COLUMN "invitedEmail" TEXT; - --- CreateIndex -CREATE UNIQUE INDEX "Membership_companyId_invitedEmail_key" ON "Membership"("companyId", "invitedEmail"); - --- CreateIndex -CREATE UNIQUE INDEX "Membership_userId_key" ON "Membership"("userId"); diff --git a/prisma/migrations/20240121190638_audit/migration.sql b/prisma/migrations/20240121190638_audit/migration.sql deleted file mode 100644 index 21ad07ed8..000000000 --- a/prisma/migrations/20240121190638_audit/migration.sql +++ /dev/null @@ -1,11 +0,0 @@ --- CreateTable -CREATE TABLE "Audit" ( - "id" TEXT NOT NULL, - "action" TEXT NOT NULL, - "occurredAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "actor" JSONB NOT NULL, - "target" JSONB[], - "context" JSONB NOT NULL, - - CONSTRAINT "Audit_pkey" PRIMARY KEY ("id") -); diff --git a/prisma/migrations/20240123073934_add_company_association_for_audit/migration.sql b/prisma/migrations/20240123073934_add_company_association_for_audit/migration.sql deleted file mode 100644 index 7292722fd..000000000 --- a/prisma/migrations/20240123073934_add_company_association_for_audit/migration.sql +++ /dev/null @@ -1,11 +0,0 @@ -/* - Warnings: - - - Added the required column `companyId` to the `Audit` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "Audit" ADD COLUMN "companyId" TEXT NOT NULL; - --- CreateIndex -CREATE INDEX "Audit_companyId_idx" ON "Audit"("companyId"); diff --git a/prisma/migrations/20240123080419_add_public_field_for_company/migration.sql b/prisma/migrations/20240123080419_add_public_field_for_company/migration.sql deleted file mode 100644 index e01178788..000000000 --- a/prisma/migrations/20240123080419_add_public_field_for_company/migration.sql +++ /dev/null @@ -1,12 +0,0 @@ -/* - Warnings: - - - A unique constraint covering the columns `[publicId]` on the table `Company` will be added. If there are existing duplicate values, this will fail. - - Added the required column `publicId` to the `Company` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "Company" ADD COLUMN "publicId" TEXT NOT NULL; - --- CreateIndex -CREATE UNIQUE INDEX "Company_publicId_key" ON "Company"("publicId"); diff --git a/prisma/migrations/20240123095815_remove_userid_unique_from_membership/migration.sql b/prisma/migrations/20240123095815_remove_userid_unique_from_membership/migration.sql deleted file mode 100644 index e4bef7fdb..000000000 --- a/prisma/migrations/20240123095815_remove_userid_unique_from_membership/migration.sql +++ /dev/null @@ -1,5 +0,0 @@ --- DropIndex -DROP INDEX "Membership_userId_key"; - --- CreateIndex -CREATE INDEX "Membership_userId_idx" ON "Membership"("userId"); diff --git a/prisma/migrations/20240124024329_/migration.sql b/prisma/migrations/20240124024329_/migration.sql deleted file mode 100644 index 04aa62483..000000000 --- a/prisma/migrations/20240124024329_/migration.sql +++ /dev/null @@ -1,32 +0,0 @@ -/* - Warnings: - - - The values [PENDING,ACCEPTED,DECLINED] on the enum `MEMBERHIP_STATUS` will be removed. If these variants are still used in the database, this will fail. - - The values [READ,WRITE,ADMIN] on the enum `MEMBERSHIP_ACCESS` will be removed. If these variants are still used in the database, this will fail. - -*/ --- AlterEnum -BEGIN; -CREATE TYPE "MEMBERHIP_STATUS_new" AS ENUM ('pending', 'accepted', 'declined'); -ALTER TABLE "Membership" ALTER COLUMN "status" DROP DEFAULT; -ALTER TABLE "Membership" ALTER COLUMN "status" TYPE "MEMBERHIP_STATUS_new" USING ("status"::text::"MEMBERHIP_STATUS_new"); -ALTER TYPE "MEMBERHIP_STATUS" RENAME TO "MEMBERHIP_STATUS_old"; -ALTER TYPE "MEMBERHIP_STATUS_new" RENAME TO "MEMBERHIP_STATUS"; -DROP TYPE "MEMBERHIP_STATUS_old"; -ALTER TABLE "Membership" ALTER COLUMN "status" SET DEFAULT 'pending'; -COMMIT; - --- AlterEnum -BEGIN; -CREATE TYPE "MEMBERSHIP_ACCESS_new" AS ENUM ('admin', 'stakeholder'); -ALTER TABLE "Membership" ALTER COLUMN "access" DROP DEFAULT; -ALTER TABLE "Membership" ALTER COLUMN "access" TYPE "MEMBERSHIP_ACCESS_new" USING ("access"::text::"MEMBERSHIP_ACCESS_new"); -ALTER TYPE "MEMBERSHIP_ACCESS" RENAME TO "MEMBERSHIP_ACCESS_old"; -ALTER TYPE "MEMBERSHIP_ACCESS_new" RENAME TO "MEMBERSHIP_ACCESS"; -DROP TYPE "MEMBERSHIP_ACCESS_old"; -ALTER TABLE "Membership" ALTER COLUMN "access" SET DEFAULT 'stakeholder'; -COMMIT; - --- AlterTable -ALTER TABLE "Membership" ALTER COLUMN "status" SET DEFAULT 'pending', -ALTER COLUMN "access" SET DEFAULT 'stakeholder'; diff --git a/prisma/migrations/20240126184544_update_migration/migration.sql b/prisma/migrations/20240126184544_update_migration/migration.sql deleted file mode 100644 index 5d5829bb0..000000000 --- a/prisma/migrations/20240126184544_update_migration/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- CreateIndex -CREATE INDEX "Membership_status_idx" ON "Membership"("status"); diff --git a/prisma/migrations/20240126192007_idx_member_status/migration.sql b/prisma/migrations/20240126192007_idx_member_status/migration.sql deleted file mode 100644 index fde787078..000000000 --- a/prisma/migrations/20240126192007_idx_member_status/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- DropIndex -DROP INDEX "Membership_status_idx"; diff --git a/prisma/migrations/20240126203821_missing_migration/migration.sql b/prisma/migrations/20240126203821_missing_migration/migration.sql deleted file mode 100644 index 5d5829bb0..000000000 --- a/prisma/migrations/20240126203821_missing_migration/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- CreateIndex -CREATE INDEX "Membership_status_idx" ON "Membership"("status"); diff --git a/prisma/migrations/20240203065505_add_summary_for_audit/migration.sql b/prisma/migrations/20240203065505_add_summary_for_audit/migration.sql deleted file mode 100644 index 323ad8703..000000000 --- a/prisma/migrations/20240203065505_add_summary_for_audit/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE "Audit" ADD COLUMN "summary" TEXT; diff --git a/prisma/migrations/20240204035614_add_share_class_and_equity_plan/migration.sql b/prisma/migrations/20240204035614_add_share_class_and_equity_plan/migration.sql deleted file mode 100644 index 4abb03fd3..000000000 --- a/prisma/migrations/20240204035614_add_share_class_and_equity_plan/migration.sql +++ /dev/null @@ -1,57 +0,0 @@ --- CreateEnum -CREATE TYPE "ShareTypeEnum" AS ENUM ('common', 'preferred'); - --- CreateEnum -CREATE TYPE "SharePrefixEnum" AS ENUM ('CS', 'PS'); - --- CreateEnum -CREATE TYPE "CancellationBehaviorEnum" AS ENUM ('RETIRE', 'RETURN_TO_POOL', 'HOLD_AS_CAPITAL_STOCK', 'DEFINED_PER_PLAN_SECURITY'); - --- CreateTable -CREATE TABLE "ShareClass" ( - "id" TEXT NOT NULL, - "idx" TEXT NOT NULL, - "name" TEXT NOT NULL, - "classType" "ShareTypeEnum" NOT NULL DEFAULT 'common', - "prefix" "SharePrefixEnum" NOT NULL DEFAULT 'CS', - "initialSharesAuthorized" BIGINT NOT NULL, - "boardApprovalDate" TIMESTAMP(3) NOT NULL, - "stockholderApprovalDate" TIMESTAMP(3) NOT NULL, - "votesPerShare" INTEGER NOT NULL, - "parValue" DOUBLE PRECISION NOT NULL, - "pricePerShare" DOUBLE PRECISION NOT NULL, - "seniority" INTEGER NOT NULL, - "conversionRights" JSONB NOT NULL DEFAULT '{"convertsToFutureRound": null,"convertsToStockClassId": null}', - "liquidationPreferenceMultiple" DOUBLE PRECISION NOT NULL, - "participationCapMultiple" DOUBLE PRECISION NOT NULL, - "companyId" TEXT NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "ShareClass_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "EquityPlan" ( - "id" TEXT NOT NULL, - "name" TEXT NOT NULL, - "boardApprovalDate" TIMESTAMP(3) NOT NULL, - "initialSharesReserved" BIGINT NOT NULL, - "defaultCancellatonBehavior" "CancellationBehaviorEnum" NOT NULL, - "comments" JSONB NOT NULL DEFAULT '[]', - "companyId" TEXT NOT NULL, - "shareClassId" TEXT NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "EquityPlan_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE INDEX "ShareClass_companyId_idx" ON "ShareClass"("companyId"); - --- CreateIndex -CREATE INDEX "EquityPlan_shareClassId_idx" ON "EquityPlan"("shareClassId"); - --- CreateIndex -CREATE INDEX "EquityPlan_companyId_idx" ON "EquityPlan"("companyId"); diff --git a/prisma/migrations/20240206030218_fix_invite_migration/migration.sql b/prisma/migrations/20240206030218_fix_invite_migration/migration.sql deleted file mode 100644 index e63e1aae1..000000000 --- a/prisma/migrations/20240206030218_fix_invite_migration/migration.sql +++ /dev/null @@ -1,17 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `invitedEmail` on the `Membership` table. All the data in the column will be lost. - - A unique constraint covering the columns `[companyId,userId]` on the table `Membership` will be added. If there are existing duplicate values, this will fail. - - Made the column `userId` on table `Membership` required. This step will fail if there are existing NULL values in that column. - -*/ --- DropIndex -DROP INDEX "Membership_companyId_invitedEmail_key"; - --- AlterTable -ALTER TABLE "Membership" DROP COLUMN "invitedEmail", -ALTER COLUMN "userId" SET NOT NULL; - --- CreateIndex -CREATE UNIQUE INDEX "Membership_companyId_userId_key" ON "Membership"("companyId", "userId"); diff --git a/prisma/migrations/20240206032010_add_missing_migration/migration.sql b/prisma/migrations/20240206032010_add_missing_migration/migration.sql deleted file mode 100644 index 11b69bb23..000000000 --- a/prisma/migrations/20240206032010_add_missing_migration/migration.sql +++ /dev/null @@ -1,12 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `conversionRights` on the `ShareClass` table. All the data in the column will be lost. - - Added the required column `convertsToFutureRound` to the `ShareClass` table without a default value. This is not possible if the table is not empty. - - Added the required column `convertsToShareClassId` to the `ShareClass` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "ShareClass" DROP COLUMN "conversionRights", -ADD COLUMN "convertsToFutureRound" BOOLEAN NOT NULL, -ADD COLUMN "convertsToShareClassId" TEXT NOT NULL; diff --git a/prisma/migrations/20240206042707_update_share_class_conversion_rights/migration.sql b/prisma/migrations/20240206042707_update_share_class_conversion_rights/migration.sql deleted file mode 100644 index 6e2236dec..000000000 --- a/prisma/migrations/20240206042707_update_share_class_conversion_rights/migration.sql +++ /dev/null @@ -1,12 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `convertsToFutureRound` on the `ShareClass` table. All the data in the column will be lost. - -*/ --- CreateEnum -CREATE TYPE "ConversionRightsEnum" AS ENUM ('convertsToFutureRound', 'convertsToShareClassId'); - --- AlterTable -ALTER TABLE "ShareClass" DROP COLUMN "convertsToFutureRound", -ADD COLUMN "conversionRights" "ConversionRightsEnum" NOT NULL DEFAULT 'convertsToFutureRound'; diff --git a/prisma/migrations/20240206230113_update_share_class_migration/migration.sql b/prisma/migrations/20240206230113_update_share_class_migration/migration.sql deleted file mode 100644 index b59b4d59c..000000000 --- a/prisma/migrations/20240206230113_update_share_class_migration/migration.sql +++ /dev/null @@ -1,13 +0,0 @@ -/* - Warnings: - - - A unique constraint covering the columns `[companyId,idx]` on the table `ShareClass` will be added. If there are existing duplicate values, this will fail. - - Changed the type of `idx` on the `ShareClass` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. - -*/ --- AlterTable -ALTER TABLE "ShareClass" DROP COLUMN "idx", -ADD COLUMN "idx" INTEGER NOT NULL; - --- CreateIndex -CREATE UNIQUE INDEX "ShareClass_companyId_idx_key" ON "ShareClass"("companyId", "idx"); diff --git a/prisma/migrations/20240207035312_optional_converts_to_share_class_id/migration.sql b/prisma/migrations/20240207035312_optional_converts_to_share_class_id/migration.sql deleted file mode 100644 index 4bdfcd087..000000000 --- a/prisma/migrations/20240207035312_optional_converts_to_share_class_id/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE "ShareClass" ALTER COLUMN "convertsToShareClassId" DROP NOT NULL; diff --git a/prisma/migrations/20240208060046_add_plan_effective_date/migration.sql b/prisma/migrations/20240208060046_add_plan_effective_date/migration.sql deleted file mode 100644 index 5a0462ee1..000000000 --- a/prisma/migrations/20240208060046_add_plan_effective_date/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE "EquityPlan" ADD COLUMN "planEffectiveDate" TIMESTAMP(3); diff --git a/prisma/migrations/20240208062212_convert_comments_to_string/migration.sql b/prisma/migrations/20240208062212_convert_comments_to_string/migration.sql deleted file mode 100644 index 5c14d1cff..000000000 --- a/prisma/migrations/20240208062212_convert_comments_to_string/migration.sql +++ /dev/null @@ -1,4 +0,0 @@ --- AlterTable -ALTER TABLE "EquityPlan" ALTER COLUMN "comments" DROP NOT NULL, -ALTER COLUMN "comments" DROP DEFAULT, -ALTER COLUMN "comments" SET DATA TYPE TEXT; diff --git a/prisma/migrations/20240208081440_add_work_email/migration.sql b/prisma/migrations/20240208081440_add_work_email/migration.sql deleted file mode 100644 index b9edaaeea..000000000 --- a/prisma/migrations/20240208081440_add_work_email/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE "Membership" ADD COLUMN "workEmail" TEXT; diff --git a/prisma/migrations/20240213070600_create_document/migration.sql b/prisma/migrations/20240213070600_create_document/migration.sql deleted file mode 100644 index 2d4b528f7..000000000 --- a/prisma/migrations/20240213070600_create_document/migration.sql +++ /dev/null @@ -1,20 +0,0 @@ --- CreateTable -CREATE TABLE "Document" ( - "id" TEXT NOT NULL, - "name" TEXT NOT NULL, - "type" TEXT NOT NULL, - "size" INTEGER NOT NULL, - "url" TEXT NOT NULL, - "companyId" TEXT NOT NULL, - "uploadedById" TEXT, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "Document_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE INDEX "Document_companyId_idx" ON "Document"("companyId"); - --- CreateIndex -CREATE INDEX "Document_uploadedById_idx" ON "Document"("uploadedById"); diff --git a/prisma/migrations/20240214010015_replace_document_url_with_key/migration.sql b/prisma/migrations/20240214010015_replace_document_url_with_key/migration.sql deleted file mode 100644 index df17309cb..000000000 --- a/prisma/migrations/20240214010015_replace_document_url_with_key/migration.sql +++ /dev/null @@ -1,10 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `url` on the `Document` table. All the data in the column will be lost. - - Added the required column `key` to the `Document` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "Document" DROP COLUMN "url", -ADD COLUMN "key" TEXT NOT NULL; diff --git a/prisma/migrations/20240214190435_modify_document_schema/migration.sql b/prisma/migrations/20240214190435_modify_document_schema/migration.sql deleted file mode 100644 index f8255d0e5..000000000 --- a/prisma/migrations/20240214190435_modify_document_schema/migration.sql +++ /dev/null @@ -1,76 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `uploadedById` on the `Document` table. All the data in the column will be lost. - - A unique constraint covering the columns `[publicId]` on the table `Document` will be added. If there are existing duplicate values, this will fail. - - Added the required column `mimeType` to the `Document` table without a default value. This is not possible if the table is not empty. - - Added the required column `publicId` to the `Document` table without a default value. This is not possible if the table is not empty. - - Added the required column `uploadProvider` to the `Document` table without a default value. This is not possible if the table is not empty. - - Added the required column `uploaderId` to the `Document` table without a default value. This is not possible if the table is not empty. - - Changed the type of `type` on the `Document` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. - -*/ --- CreateEnum -CREATE TYPE "UploadProviders" AS ENUM ('S3', 'R2'); - --- CreateEnum -CREATE TYPE "DocumentType" AS ENUM ('SAFE', 'EQUITY', 'GENERIC'); - --- CreateEnum -CREATE TYPE "DocumentStatus" AS ENUM ('DRAFT', 'COMPLETED'); - --- CreateEnum -CREATE TYPE "DocumentFieldTypes" AS ENUM ('TEXT', 'TEXT_AREA', 'RADIO', 'CHECK_BOX', 'SIGNATURE', 'DATE', 'DATE_TIME', 'EMAIL'); - --- CreateEnum -CREATE TYPE "DocumentSigningStatus" AS ENUM ('NOT_SIGNED', 'SIGNED'); - --- DropIndex -DROP INDEX "Document_uploadedById_idx"; - --- AlterTable -ALTER TABLE "Document" DROP COLUMN "uploadedById", -ADD COLUMN "mimeType" TEXT NOT NULL, -ADD COLUMN "publicId" TEXT NOT NULL, -ADD COLUMN "status" "DocumentStatus" NOT NULL DEFAULT 'DRAFT', -ADD COLUMN "uploadProvider" "UploadProviders" NOT NULL, -ADD COLUMN "uploaderId" TEXT NOT NULL, -DROP COLUMN "type", -ADD COLUMN "type" "DocumentType" NOT NULL; - --- CreateTable -CREATE TABLE "DocumentFields" ( - "id" TEXT NOT NULL, - "name" TEXT NOT NULL, - "type" "DocumentFieldTypes" NOT NULL DEFAULT 'TEXT', - "placeholder" TEXT NOT NULL DEFAULT '', - "required" BOOLEAN NOT NULL DEFAULT false, - "documentId" TEXT NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "DocumentFields_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "DocumentRecepients" ( - "id" TEXT NOT NULL, - "signedStatus" "DocumentSigningStatus" NOT NULL, - "membershipId" TEXT NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "DocumentRecepients_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE INDEX "DocumentFields_documentId_idx" ON "DocumentFields"("documentId"); - --- CreateIndex -CREATE INDEX "DocumentRecepients_membershipId_idx" ON "DocumentRecepients"("membershipId"); - --- CreateIndex -CREATE INDEX "Document_uploaderId_idx" ON "Document"("uploaderId"); - --- CreateIndex -CREATE UNIQUE INDEX "Document_publicId_key" ON "Document"("publicId"); diff --git a/prisma/migrations/20240215144007_add_bucket_and_template_models/migration.sql b/prisma/migrations/20240215144007_add_bucket_and_template_models/migration.sql deleted file mode 100644 index 439f84796..000000000 --- a/prisma/migrations/20240215144007_add_bucket_and_template_models/migration.sql +++ /dev/null @@ -1,128 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `key` on the `Document` table. All the data in the column will be lost. - - You are about to drop the column `mimeType` on the `Document` table. All the data in the column will be lost. - - You are about to drop the column `size` on the `Document` table. All the data in the column will be lost. - - You are about to drop the column `status` on the `Document` table. All the data in the column will be lost. - - You are about to drop the column `type` on the `Document` table. All the data in the column will be lost. - - You are about to drop the column `uploadProvider` on the `Document` table. All the data in the column will be lost. - - You are about to drop the `DocumentFields` table. If the table is not empty, all the data it contains will be lost. - - You are about to drop the `DocumentRecepients` table. If the table is not empty, all the data it contains will be lost. - - Added the required column `bucketId` to the `Document` table without a default value. This is not possible if the table is not empty. - -*/ --- CreateEnum -CREATE TYPE "FieldTypes" AS ENUM ('text', 'textArea', 'radio', 'checkBox', 'signature', 'date', 'dateTime', 'email'); - --- CreateEnum -CREATE TYPE "TemplateStatus" AS ENUM ('draft', 'completed'); - --- CreateEnum -CREATE TYPE "EsignRecipientStatus" AS ENUM ('notSigned', 'signed'); - --- AlterTable -ALTER TABLE "Document" DROP COLUMN "key", -DROP COLUMN "mimeType", -DROP COLUMN "size", -DROP COLUMN "status", -DROP COLUMN "type", -DROP COLUMN "uploadProvider", -ADD COLUMN "bucketId" TEXT NOT NULL; - --- DropTable -DROP TABLE "DocumentFields"; - --- DropTable -DROP TABLE "DocumentRecepients"; - --- DropEnum -DROP TYPE "DocumentFieldTypes"; - --- DropEnum -DROP TYPE "DocumentSigningStatus"; - --- DropEnum -DROP TYPE "DocumentStatus"; - --- DropEnum -DROP TYPE "DocumentType"; - --- DropEnum -DROP TYPE "UploadProviders"; - --- CreateTable -CREATE TABLE "Bucket" ( - "id" TEXT NOT NULL, - "name" TEXT NOT NULL, - "key" TEXT NOT NULL, - "mimeType" TEXT NOT NULL, - "size" INTEGER NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "Bucket_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "TemplateField" ( - "id" TEXT NOT NULL, - "name" TEXT NOT NULL, - "type" "FieldTypes" NOT NULL DEFAULT 'text', - "placeholder" TEXT NOT NULL DEFAULT '', - "required" BOOLEAN NOT NULL DEFAULT false, - "positionX" DECIMAL(65,30) NOT NULL, - "positionY" DECIMAL(65,30) NOT NULL, - "width" DECIMAL(65,30) NOT NULL, - "height" DECIMAL(65,30) NOT NULL, - "templateId" TEXT NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "TemplateField_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "Template" ( - "id" TEXT NOT NULL, - "publicId" TEXT NOT NULL, - "name" TEXT NOT NULL, - "status" "TemplateStatus" NOT NULL DEFAULT 'draft', - "bucketId" TEXT NOT NULL, - "uploaderId" TEXT NOT NULL, - "companyId" TEXT NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "Template_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "EsignRecipient" ( - "id" TEXT NOT NULL, - "email" TEXT, - "status" "EsignRecipientStatus" NOT NULL, - "membershipId" TEXT, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "EsignRecipient_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE INDEX "TemplateField_templateId_idx" ON "TemplateField"("templateId"); - --- CreateIndex -CREATE INDEX "Template_bucketId_idx" ON "Template"("bucketId"); - --- CreateIndex -CREATE INDEX "Template_uploaderId_idx" ON "Template"("uploaderId"); - --- CreateIndex -CREATE INDEX "Template_companyId_idx" ON "Template"("companyId"); - --- CreateIndex -CREATE INDEX "EsignRecipient_membershipId_idx" ON "EsignRecipient"("membershipId"); - --- CreateIndex -CREATE INDEX "Document_bucketId_idx" ON "Document"("bucketId"); diff --git a/prisma/migrations/20240215153900_add_new_fields/migration.sql b/prisma/migrations/20240215153900_add_new_fields/migration.sql deleted file mode 100644 index 4ad2a3982..000000000 --- a/prisma/migrations/20240215153900_add_new_fields/migration.sql +++ /dev/null @@ -1,15 +0,0 @@ -/* - Warnings: - - - Added the required column `verificationTokenToken` to the `EsignRecipient` table without a default value. This is not possible if the table is not empty. - - Added the required column `order` to the `TemplateField` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "EsignRecipient" ADD COLUMN "verificationTokenToken" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "TemplateField" ADD COLUMN "order" INTEGER NOT NULL; - --- CreateIndex -CREATE INDEX "EsignRecipient_verificationTokenToken_idx" ON "EsignRecipient"("verificationTokenToken"); diff --git a/prisma/migrations/20240216224520_update_db_schema_and_enums/migration.sql b/prisma/migrations/20240216224520_update_db_schema_and_enums/migration.sql deleted file mode 100644 index 8ca8884c9..000000000 --- a/prisma/migrations/20240216224520_update_db_schema_and_enums/migration.sql +++ /dev/null @@ -1,123 +0,0 @@ -/* - Warnings: - - - The values [convertsToFutureRound,convertsToShareClassId] on the enum `ConversionRightsEnum` will be removed. If these variants are still used in the database, this will fail. - - The values [notSigned,signed] on the enum `EsignRecipientStatus` will be removed. If these variants are still used in the database, this will fail. - - The values [text,textArea,radio,checkBox,signature,date,dateTime,email] on the enum `FieldTypes` will be removed. If these variants are still used in the database, this will fail. - - The values [pending,accepted,declined] on the enum `MEMBERHIP_STATUS` will be removed. If these variants are still used in the database, this will fail. - - The values [admin,stakeholder] on the enum `MEMBERSHIP_ACCESS` will be removed. If these variants are still used in the database, this will fail. - - The values [common,preferred] on the enum `ShareTypeEnum` will be removed. If these variants are still used in the database, this will fail. - - The values [draft,completed] on the enum `TemplateStatus` will be removed. If these variants are still used in the database, this will fail. - - You are about to drop the column `verificationTokenToken` on the `EsignRecipient` table. All the data in the column will be lost. - -*/ --- CreateEnum -CREATE TYPE "StakeholderTypeEnum" AS ENUM ('INDIVIDUAL', 'INSTITUTION'); - --- AlterEnum -BEGIN; -CREATE TYPE "ConversionRightsEnum_new" AS ENUM ('CONVERTS_TO_FUTURE_ROUND', 'CONVERTS_TO_SHARE_CLASS_ID'); -ALTER TABLE "ShareClass" ALTER COLUMN "conversionRights" DROP DEFAULT; -ALTER TABLE "ShareClass" ALTER COLUMN "conversionRights" TYPE "ConversionRightsEnum_new" USING ("conversionRights"::text::"ConversionRightsEnum_new"); -ALTER TYPE "ConversionRightsEnum" RENAME TO "ConversionRightsEnum_old"; -ALTER TYPE "ConversionRightsEnum_new" RENAME TO "ConversionRightsEnum"; -DROP TYPE "ConversionRightsEnum_old"; -ALTER TABLE "ShareClass" ALTER COLUMN "conversionRights" SET DEFAULT 'CONVERTS_TO_FUTURE_ROUND'; -COMMIT; - --- AlterEnum -BEGIN; -CREATE TYPE "EsignRecipientStatus_new" AS ENUM ('SENT', 'SIGNED', 'PENDING'); -ALTER TABLE "EsignRecipient" ALTER COLUMN "status" TYPE "EsignRecipientStatus_new" USING ("status"::text::"EsignRecipientStatus_new"); -ALTER TYPE "EsignRecipientStatus" RENAME TO "EsignRecipientStatus_old"; -ALTER TYPE "EsignRecipientStatus_new" RENAME TO "EsignRecipientStatus"; -DROP TYPE "EsignRecipientStatus_old"; -COMMIT; - --- AlterEnum -BEGIN; -CREATE TYPE "FieldTypes_new" AS ENUM ('TEXT', 'RADIO', 'EMAIL', 'DATE', 'DATETIME', 'TEXTAREA', 'CHECKBOX', 'SIGNATURE'); -ALTER TABLE "TemplateField" ALTER COLUMN "type" DROP DEFAULT; -ALTER TABLE "TemplateField" ALTER COLUMN "type" TYPE "FieldTypes_new" USING ("type"::text::"FieldTypes_new"); -ALTER TYPE "FieldTypes" RENAME TO "FieldTypes_old"; -ALTER TYPE "FieldTypes_new" RENAME TO "FieldTypes"; -DROP TYPE "FieldTypes_old"; -ALTER TABLE "TemplateField" ALTER COLUMN "type" SET DEFAULT 'TEXT'; -COMMIT; - --- AlterEnum -BEGIN; -CREATE TYPE "MEMBERHIP_STATUS_new" AS ENUM ('PENDING', 'ACCEPTED', 'DECLINED'); -ALTER TABLE "Membership" ALTER COLUMN "status" DROP DEFAULT; -ALTER TABLE "Membership" ALTER COLUMN "status" TYPE "MEMBERHIP_STATUS_new" USING ("status"::text::"MEMBERHIP_STATUS_new"); -ALTER TYPE "MEMBERHIP_STATUS" RENAME TO "MEMBERHIP_STATUS_old"; -ALTER TYPE "MEMBERHIP_STATUS_new" RENAME TO "MEMBERHIP_STATUS"; -DROP TYPE "MEMBERHIP_STATUS_old"; -ALTER TABLE "Membership" ALTER COLUMN "status" SET DEFAULT 'PENDING'; -COMMIT; - --- AlterEnum -BEGIN; -CREATE TYPE "MEMBERSHIP_ACCESS_new" AS ENUM ('ADMIN', 'STAKEHOLDER'); -ALTER TABLE "Membership" ALTER COLUMN "access" DROP DEFAULT; -ALTER TABLE "Membership" ALTER COLUMN "access" TYPE "MEMBERSHIP_ACCESS_new" USING ("access"::text::"MEMBERSHIP_ACCESS_new"); -ALTER TYPE "MEMBERSHIP_ACCESS" RENAME TO "MEMBERSHIP_ACCESS_old"; -ALTER TYPE "MEMBERSHIP_ACCESS_new" RENAME TO "MEMBERSHIP_ACCESS"; -DROP TYPE "MEMBERSHIP_ACCESS_old"; -ALTER TABLE "Membership" ALTER COLUMN "access" SET DEFAULT 'ADMIN'; -COMMIT; - --- AlterEnum -BEGIN; -CREATE TYPE "ShareTypeEnum_new" AS ENUM ('COMMON', 'PREFERRED'); -ALTER TABLE "ShareClass" ALTER COLUMN "classType" DROP DEFAULT; -ALTER TABLE "ShareClass" ALTER COLUMN "classType" TYPE "ShareTypeEnum_new" USING ("classType"::text::"ShareTypeEnum_new"); -ALTER TYPE "ShareTypeEnum" RENAME TO "ShareTypeEnum_old"; -ALTER TYPE "ShareTypeEnum_new" RENAME TO "ShareTypeEnum"; -DROP TYPE "ShareTypeEnum_old"; -ALTER TABLE "ShareClass" ALTER COLUMN "classType" SET DEFAULT 'COMMON'; -COMMIT; - --- AlterEnum -BEGIN; -CREATE TYPE "TemplateStatus_new" AS ENUM ('DRAFT', 'COMPLETE'); -ALTER TABLE "Template" ALTER COLUMN "status" DROP DEFAULT; -ALTER TABLE "Template" ALTER COLUMN "status" TYPE "TemplateStatus_new" USING ("status"::text::"TemplateStatus_new"); -ALTER TYPE "TemplateStatus" RENAME TO "TemplateStatus_old"; -ALTER TYPE "TemplateStatus_new" RENAME TO "TemplateStatus"; -DROP TYPE "TemplateStatus_old"; -ALTER TABLE "Template" ALTER COLUMN "status" SET DEFAULT 'DRAFT'; -COMMIT; - --- DropIndex -DROP INDEX "EsignRecipient_verificationTokenToken_idx"; - --- AlterTable -ALTER TABLE "EsignRecipient" DROP COLUMN "verificationTokenToken", -ALTER COLUMN "status" SET DEFAULT 'PENDING'; - --- AlterTable -ALTER TABLE "Membership" ALTER COLUMN "status" SET DEFAULT 'PENDING', -ALTER COLUMN "access" SET DEFAULT 'ADMIN'; - --- AlterTable -ALTER TABLE "ShareClass" ALTER COLUMN "classType" SET DEFAULT 'COMMON', -ALTER COLUMN "conversionRights" SET DEFAULT 'CONVERTS_TO_FUTURE_ROUND'; - --- AlterTable -ALTER TABLE "Template" ALTER COLUMN "status" SET DEFAULT 'DRAFT'; - --- AlterTable -ALTER TABLE "TemplateField" ALTER COLUMN "type" SET DEFAULT 'TEXT'; - --- CreateTable -CREATE TABLE "Stakeholder" ( - "id" TEXT NOT NULL, - "name" TEXT NOT NULL, - "email" TEXT NOT NULL, - "type" "StakeholderTypeEnum" NOT NULL DEFAULT 'INSTITUTION', - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "Stakeholder_pkey" PRIMARY KEY ("id") -); diff --git a/prisma/migrations/20240217134858_rename_position_field/migration.sql b/prisma/migrations/20240217134858_rename_position_field/migration.sql deleted file mode 100644 index 8f709999f..000000000 --- a/prisma/migrations/20240217134858_rename_position_field/migration.sql +++ /dev/null @@ -1,14 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `positionX` on the `TemplateField` table. All the data in the column will be lost. - - You are about to drop the column `positionY` on the `TemplateField` table. All the data in the column will be lost. - - Added the required column `left` to the `TemplateField` table without a default value. This is not possible if the table is not empty. - - Added the required column `top` to the `TemplateField` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "TemplateField" DROP COLUMN "positionX", -DROP COLUMN "positionY", -ADD COLUMN "left" DECIMAL(65,30) NOT NULL, -ADD COLUMN "top" DECIMAL(65,30) NOT NULL; diff --git a/prisma/migrations/20240217135154_remove_order/migration.sql b/prisma/migrations/20240217135154_remove_order/migration.sql deleted file mode 100644 index 765464c7e..000000000 --- a/prisma/migrations/20240217135154_remove_order/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `order` on the `TemplateField` table. All the data in the column will be lost. - -*/ --- AlterTable -ALTER TABLE "TemplateField" DROP COLUMN "order"; diff --git a/prisma/migrations/20240217170744_change_data_type/migration.sql b/prisma/migrations/20240217170744_change_data_type/migration.sql deleted file mode 100644 index 6e96d5d94..000000000 --- a/prisma/migrations/20240217170744_change_data_type/migration.sql +++ /dev/null @@ -1,14 +0,0 @@ -/* - Warnings: - - - You are about to alter the column `width` on the `TemplateField` table. The data in that column could be lost. The data in that column will be cast from `Decimal(65,30)` to `Integer`. - - You are about to alter the column `height` on the `TemplateField` table. The data in that column could be lost. The data in that column will be cast from `Decimal(65,30)` to `Integer`. - - You are about to alter the column `left` on the `TemplateField` table. The data in that column could be lost. The data in that column will be cast from `Decimal(65,30)` to `Integer`. - - You are about to alter the column `top` on the `TemplateField` table. The data in that column could be lost. The data in that column will be cast from `Decimal(65,30)` to `Integer`. - -*/ --- AlterTable -ALTER TABLE "TemplateField" ALTER COLUMN "width" SET DATA TYPE INTEGER, -ALTER COLUMN "height" SET DATA TYPE INTEGER, -ALTER COLUMN "left" SET DATA TYPE INTEGER, -ALTER COLUMN "top" SET DATA TYPE INTEGER; diff --git a/prisma/migrations/20240218214308_add_team_table/migration.sql b/prisma/migrations/20240218214308_add_team_table/migration.sql deleted file mode 100644 index 303a6562d..000000000 --- a/prisma/migrations/20240218214308_add_team_table/migration.sql +++ /dev/null @@ -1,28 +0,0 @@ --- CreateEnum -CREATE TYPE "TeamStatus" AS ENUM ('PENDING', 'ACCEPTED'); - --- CreateTable -CREATE TABLE "Team" ( - "id" TEXT NOT NULL, - "status" "TeamStatus" NOT NULL DEFAULT 'PENDING', - "active" BOOLEAN NOT NULL DEFAULT true, - "isOnboarded" BOOLEAN NOT NULL DEFAULT false, - "userId" TEXT NOT NULL, - "companyId" TEXT NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - "inviteAt" TIMESTAMP(3), - "acceptedAt" TIMESTAMP(3), - "accessedAt" TIMESTAMP(3), - - CONSTRAINT "Team_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE INDEX "Team_userId_idx" ON "Team"("userId"); - --- CreateIndex -CREATE INDEX "Team_companyId_idx" ON "Team"("companyId"); - --- CreateIndex -CREATE UNIQUE INDEX "Team_companyId_userId_key" ON "Team"("companyId", "userId"); diff --git a/prisma/migrations/20240218215510_add_title_to_team/migration.sql b/prisma/migrations/20240218215510_add_title_to_team/migration.sql deleted file mode 100644 index 0ac750ab0..000000000 --- a/prisma/migrations/20240218215510_add_title_to_team/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ -/* - Warnings: - - - Added the required column `title` to the `Team` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "Team" ADD COLUMN "title" TEXT NOT NULL; diff --git a/prisma/migrations/20240218230234_update_team_schema/migration.sql b/prisma/migrations/20240218230234_update_team_schema/migration.sql deleted file mode 100644 index 5285c0ac0..000000000 --- a/prisma/migrations/20240218230234_update_team_schema/migration.sql +++ /dev/null @@ -1,20 +0,0 @@ -/* - Warnings: - - - The values [ACCEPTED] on the enum `TeamStatus` will be removed. If these variants are still used in the database, this will fail. - - You are about to drop the column `active` on the `Team` table. All the data in the column will be lost. - -*/ --- AlterEnum -BEGIN; -CREATE TYPE "TeamStatus_new" AS ENUM ('ACTIVE', 'PENDING', 'INACTIVE'); -ALTER TABLE "Team" ALTER COLUMN "status" DROP DEFAULT; -ALTER TABLE "Team" ALTER COLUMN "status" TYPE "TeamStatus_new" USING ("status"::text::"TeamStatus_new"); -ALTER TYPE "TeamStatus" RENAME TO "TeamStatus_old"; -ALTER TYPE "TeamStatus_new" RENAME TO "TeamStatus"; -DROP TYPE "TeamStatus_old"; -ALTER TABLE "Team" ALTER COLUMN "status" SET DEFAULT 'PENDING'; -COMMIT; - --- AlterTable -ALTER TABLE "Team" DROP COLUMN "active"; diff --git a/prisma/migrations/20240218235419_update_enums/migration.sql b/prisma/migrations/20240218235419_update_enums/migration.sql deleted file mode 100644 index b6af0cca6..000000000 --- a/prisma/migrations/20240218235419_update_enums/migration.sql +++ /dev/null @@ -1,34 +0,0 @@ -/* - Warnings: - - - The `status` column on the `Membership` table would be dropped and recreated. This will lead to data loss if there is data in the column. - - The `access` column on the `Membership` table would be dropped and recreated. This will lead to data loss if there is data in the column. - - You are about to drop the `Team` table. If the table is not empty, all the data it contains will be lost. - -*/ --- CreateEnum -CREATE TYPE "MembershipStatusEnum" AS ENUM ('PENDING', 'ACCEPTED', 'DECLINED'); - --- CreateEnum -CREATE TYPE "MembershipAccessEnum" AS ENUM ('ADMIN', 'STAKEHOLDER'); - --- AlterTable -ALTER TABLE "Membership" DROP COLUMN "status", -ADD COLUMN "status" "MembershipStatusEnum" NOT NULL DEFAULT 'PENDING', -DROP COLUMN "access", -ADD COLUMN "access" "MembershipAccessEnum" NOT NULL DEFAULT 'ADMIN'; - --- DropTable -DROP TABLE "Team"; - --- DropEnum -DROP TYPE "MEMBERHIP_STATUS"; - --- DropEnum -DROP TYPE "MEMBERSHIP_ACCESS"; - --- DropEnum -DROP TYPE "TeamStatus"; - --- CreateIndex -CREATE INDEX "Membership_status_idx" ON "Membership"("status"); diff --git a/prisma/migrations/20240219002354_/migration.sql b/prisma/migrations/20240219002354_/migration.sql deleted file mode 100644 index c7afb3e3b..000000000 --- a/prisma/migrations/20240219002354_/migration.sql +++ /dev/null @@ -1,25 +0,0 @@ -/* - Warnings: - - - The values [ACCEPTED,DECLINED] on the enum `MembershipStatusEnum` will be removed. If these variants are still used in the database, this will fail. - - You are about to drop the column `access` on the `Membership` table. All the data in the column will be lost. - - You are about to drop the column `active` on the `Membership` table. All the data in the column will be lost. - -*/ --- AlterEnum -BEGIN; -CREATE TYPE "MembershipStatusEnum_new" AS ENUM ('ACTIVE', 'INACTIVE', 'PENDING'); -ALTER TABLE "Membership" ALTER COLUMN "status" DROP DEFAULT; -ALTER TABLE "Membership" ALTER COLUMN "status" TYPE "MembershipStatusEnum_new" USING ("status"::text::"MembershipStatusEnum_new"); -ALTER TYPE "MembershipStatusEnum" RENAME TO "MembershipStatusEnum_old"; -ALTER TYPE "MembershipStatusEnum_new" RENAME TO "MembershipStatusEnum"; -DROP TYPE "MembershipStatusEnum_old"; -ALTER TABLE "Membership" ALTER COLUMN "status" SET DEFAULT 'PENDING'; -COMMIT; - --- AlterTable -ALTER TABLE "Membership" DROP COLUMN "access", -DROP COLUMN "active"; - --- DropEnum -DROP TYPE "MembershipAccessEnum"; diff --git a/prisma/migrations/20240219083043_rename_membership_to_member/migration.sql b/prisma/migrations/20240219083043_rename_membership_to_member/migration.sql deleted file mode 100644 index a39be9a6a..000000000 --- a/prisma/migrations/20240219083043_rename_membership_to_member/migration.sql +++ /dev/null @@ -1,53 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `membershipId` on the `EsignRecipient` table. All the data in the column will be lost. - - You are about to drop the `Membership` table. If the table is not empty, all the data it contains will be lost. - -*/ --- CreateEnum -CREATE TYPE "MemberStatusEnum" AS ENUM ('ACTIVE', 'INACTIVE', 'PENDING'); - --- DropIndex -DROP INDEX "EsignRecipient_membershipId_idx"; - --- AlterTable -ALTER TABLE "EsignRecipient" DROP COLUMN "membershipId", -ADD COLUMN "memberId" TEXT; - --- DropTable -DROP TABLE "Membership"; - --- DropEnum -DROP TYPE "MembershipStatusEnum"; - --- CreateTable -CREATE TABLE "Member" ( - "id" TEXT NOT NULL, - "title" TEXT, - "status" "MemberStatusEnum" NOT NULL DEFAULT 'PENDING', - "isOnboarded" BOOLEAN NOT NULL DEFAULT false, - "workEmail" TEXT, - "lastAccessed" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - "userId" TEXT NOT NULL, - "companyId" TEXT NOT NULL, - - CONSTRAINT "Member_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE INDEX "Member_companyId_idx" ON "Member"("companyId"); - --- CreateIndex -CREATE INDEX "Member_status_idx" ON "Member"("status"); - --- CreateIndex -CREATE INDEX "Member_userId_idx" ON "Member"("userId"); - --- CreateIndex -CREATE UNIQUE INDEX "Member_companyId_userId_key" ON "Member"("companyId", "userId"); - --- CreateIndex -CREATE INDEX "EsignRecipient_memberId_idx" ON "EsignRecipient"("memberId"); diff --git a/prisma/migrations/20240222042734_add_stakeholder/migration.sql b/prisma/migrations/20240222042734_add_stakeholder/migration.sql deleted file mode 100644 index 50f04b427..000000000 --- a/prisma/migrations/20240222042734_add_stakeholder/migration.sql +++ /dev/null @@ -1,24 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `type` on the `Stakeholder` table. All the data in the column will be lost. - - Added the required column `companyId` to the `Stakeholder` table without a default value. This is not possible if the table is not empty. - -*/ --- CreateEnum -CREATE TYPE "StakeholderRelationshipEnum" AS ENUM ('ADVISOR', 'BOARD_MEMBER', 'CONSULTANT', 'EMPLOYEE', 'EX_ADVISOR', 'EX_CONSULTANT', 'EX_EMPLOYEE', 'EXECUTIVE', 'FOUNDER', 'INVESTOR', 'NON_US_EMPLOYEE', 'OFFICER', 'OTHER'); - --- AlterTable -ALTER TABLE "Stakeholder" DROP COLUMN "type", -ADD COLUMN "city" TEXT, -ADD COLUMN "companyId" TEXT NOT NULL, -ADD COLUMN "currentRelationship" "StakeholderRelationshipEnum" NOT NULL DEFAULT 'EMPLOYEE', -ADD COLUMN "institutionName" TEXT, -ADD COLUMN "stakeholder_type" "StakeholderTypeEnum" NOT NULL DEFAULT 'INDIVIDUAL', -ADD COLUMN "state" TEXT, -ADD COLUMN "streetAddress" TEXT, -ADD COLUMN "taxId" TEXT, -ADD COLUMN "zipcode" TEXT; - --- CreateIndex -CREATE INDEX "Stakeholder_companyId_idx" ON "Stakeholder"("companyId"); diff --git a/prisma/migrations/20240226162609_add_new_viewport_field/migration.sql b/prisma/migrations/20240226162609_add_new_viewport_field/migration.sql deleted file mode 100644 index d7b508cce..000000000 --- a/prisma/migrations/20240226162609_add_new_viewport_field/migration.sql +++ /dev/null @@ -1,10 +0,0 @@ -/* - Warnings: - - - Added the required column `viewportHeight` to the `TemplateField` table without a default value. This is not possible if the table is not empty. - - Added the required column `viewportWidth` to the `TemplateField` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "TemplateField" ADD COLUMN "viewportHeight" INTEGER NOT NULL, -ADD COLUMN "viewportWidth" INTEGER NOT NULL; diff --git a/prisma/migrations/20240227052735_create_investment_table/migration.sql b/prisma/migrations/20240227052735_create_investment_table/migration.sql deleted file mode 100644 index cdd7fb820..000000000 --- a/prisma/migrations/20240227052735_create_investment_table/migration.sql +++ /dev/null @@ -1,24 +0,0 @@ --- CreateTable -CREATE TABLE "Investment" ( - "id" TEXT NOT NULL, - "amount" DOUBLE PRECISION NOT NULL, - "shares" BIGINT NOT NULL, - "date" TIMESTAMP(3) NOT NULL, - "comments" TEXT, - "shareClassId" TEXT NOT NULL, - "companyId" TEXT NOT NULL, - "stakeholderId" TEXT NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "Investment_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE INDEX "Investment_companyId_idx" ON "Investment"("companyId"); - --- CreateIndex -CREATE INDEX "Investment_stakeholderId_idx" ON "Investment"("stakeholderId"); - --- CreateIndex -CREATE INDEX "Investment_shareClassId_idx" ON "Investment"("shareClassId"); diff --git a/prisma/migrations/20240228095749_add_page_field/migration.sql b/prisma/migrations/20240228095749_add_page_field/migration.sql deleted file mode 100644 index 1d563b811..000000000 --- a/prisma/migrations/20240228095749_add_page_field/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ -/* - Warnings: - - - Added the required column `page` to the `TemplateField` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "TemplateField" ADD COLUMN "page" INTEGER NOT NULL; diff --git a/prisma/migrations/20240301064354_update_stakeholder/migration.sql b/prisma/migrations/20240301064354_update_stakeholder/migration.sql deleted file mode 100644 index cb2bf2cd7..000000000 --- a/prisma/migrations/20240301064354_update_stakeholder/migration.sql +++ /dev/null @@ -1,13 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `stakeholder_type` on the `Stakeholder` table. All the data in the column will be lost. - - A unique constraint covering the columns `[email]` on the table `Stakeholder` will be added. If there are existing duplicate values, this will fail. - -*/ --- AlterTable -ALTER TABLE "Stakeholder" DROP COLUMN "stakeholder_type", -ADD COLUMN "stakeholderType" "StakeholderTypeEnum" NOT NULL DEFAULT 'INDIVIDUAL'; - --- CreateIndex -CREATE UNIQUE INDEX "Stakeholder_email_key" ON "Stakeholder"("email"); diff --git a/prisma/migrations/20240304075022_remove_waitlist_table/migration.sql b/prisma/migrations/20240304075022_remove_waitlist_table/migration.sql deleted file mode 100644 index 152b88804..000000000 --- a/prisma/migrations/20240304075022_remove_waitlist_table/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ -/* - Warnings: - - - You are about to drop the `WaitlistUser` table. If the table is not empty, all the data it contains will be lost. - -*/ --- DropTable -DROP TABLE "WaitlistUser"; diff --git a/prisma/migrations/20240305033321_create_share/migration.sql b/prisma/migrations/20240305033321_create_share/migration.sql deleted file mode 100644 index c77776a6b..000000000 --- a/prisma/migrations/20240305033321_create_share/migration.sql +++ /dev/null @@ -1,50 +0,0 @@ --- CreateEnum -CREATE TYPE "SecuritiesStatusEnum" AS ENUM ('ACTIVE', 'DRAFT', 'SIGNED', 'PENDING'); - --- CreateEnum -CREATE TYPE "VestingScheduleEnum" AS ENUM ('VESTING_0_0_0', 'VESTING_0_0_1', 'VESTING_4_1_0', 'VESTING_4_1_1', 'VESTING_4_3_1', 'VESTING_4_6_1', 'VESTING_4_12_1'); - --- CreateEnum -CREATE TYPE "ShareLegendsEnum" AS ENUM ('US_SECURITIES_ACT', 'SALE_AND_ROFR', 'TRANSFER_RESTRICTIONS'); - --- AlterTable -ALTER TABLE "Document" ADD COLUMN "shareId" TEXT; - --- CreateTable -CREATE TABLE "Share" ( - "id" TEXT NOT NULL, - "status" "SecuritiesStatusEnum" NOT NULL DEFAULT 'DRAFT', - "notes" TEXT, - "certificateId" TEXT NOT NULL, - "quantity" DOUBLE PRECISION NOT NULL, - "pricePerShare" DOUBLE PRECISION, - "capitalContribution" DOUBLE PRECISION, - "ipContribution" DOUBLE PRECISION, - "debtCancelled" DOUBLE PRECISION, - "otherContributions" DOUBLE PRECISION, - "vestingSchedule" "VestingScheduleEnum" NOT NULL, - "companyLegends" "ShareLegendsEnum"[], - "issueDate" TIMESTAMP(3) NOT NULL, - "rule144Date" TIMESTAMP(3), - "vestingStartDate" TIMESTAMP(3), - "boardApprovalDate" TIMESTAMP(3) NOT NULL, - "stakeholderId" TEXT NOT NULL, - "companyId" TEXT NOT NULL, - "shareClassId" TEXT NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "Share_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE INDEX "Share_companyId_idx" ON "Share"("companyId"); - --- CreateIndex -CREATE INDEX "Share_shareClassId_idx" ON "Share"("shareClassId"); - --- CreateIndex -CREATE INDEX "Share_stakeholderId_idx" ON "Share"("stakeholderId"); - --- CreateIndex -CREATE INDEX "Document_shareId_idx" ON "Document"("shareId"); diff --git a/prisma/migrations/20240305040106_create_options/migration.sql b/prisma/migrations/20240305040106_create_options/migration.sql deleted file mode 100644 index f73b2c72d..000000000 --- a/prisma/migrations/20240305040106_create_options/migration.sql +++ /dev/null @@ -1,52 +0,0 @@ -/* - Warnings: - - - You are about to alter the column `quantity` on the `Share` table. The data in that column could be lost. The data in that column will be cast from `DoublePrecision` to `Integer`. - -*/ --- CreateEnum -CREATE TYPE "OptionTypeEnum" AS ENUM ('STOCK_OPTION', 'WARRANT'); - --- CreateEnum -CREATE TYPE "OptionStatusEnum" AS ENUM ('DRAFT', 'ACTIVE', 'EXERCISED', 'EXPIRED', 'CANCELLED'); - --- AlterTable -ALTER TABLE "Document" ADD COLUMN "optionId" TEXT; - --- AlterTable -ALTER TABLE "Share" ALTER COLUMN "quantity" SET DATA TYPE INTEGER; - --- CreateTable -CREATE TABLE "Option" ( - "id" TEXT NOT NULL, - "notes" TEXT, - "quantity" INTEGER NOT NULL, - "exercisePrice" DOUBLE PRECISION NOT NULL, - "type" "OptionTypeEnum" NOT NULL, - "status" "OptionStatusEnum" NOT NULL DEFAULT 'DRAFT', - "vestingSchedule" "VestingScheduleEnum" NOT NULL, - "issueDate" TIMESTAMP(3) NOT NULL, - "expirationDate" TIMESTAMP(3) NOT NULL, - "vestingStartDate" TIMESTAMP(3) NOT NULL, - "boardApprovalDate" TIMESTAMP(3) NOT NULL, - "rule144Date" TIMESTAMP(3) NOT NULL, - "stakeholderId" TEXT NOT NULL, - "companyId" TEXT NOT NULL, - "equityPlanId" TEXT NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "Option_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE INDEX "Option_companyId_idx" ON "Option"("companyId"); - --- CreateIndex -CREATE INDEX "Option_equityPlanId_idx" ON "Option"("equityPlanId"); - --- CreateIndex -CREATE INDEX "Option_stakeholderId_idx" ON "Option"("stakeholderId"); - --- CreateIndex -CREATE INDEX "Document_optionId_idx" ON "Document"("optionId"); diff --git a/prisma/migrations/20240305040535_update_option_types/migration.sql b/prisma/migrations/20240305040535_update_option_types/migration.sql deleted file mode 100644 index 3a3a3c3b9..000000000 --- a/prisma/migrations/20240305040535_update_option_types/migration.sql +++ /dev/null @@ -1,14 +0,0 @@ -/* - Warnings: - - - The values [STOCK_OPTION,WARRANT] on the enum `OptionTypeEnum` will be removed. If these variants are still used in the database, this will fail. - -*/ --- AlterEnum -BEGIN; -CREATE TYPE "OptionTypeEnum_new" AS ENUM ('ISO', 'NSO', 'RSU'); -ALTER TABLE "Option" ALTER COLUMN "type" TYPE "OptionTypeEnum_new" USING ("type"::text::"OptionTypeEnum_new"); -ALTER TYPE "OptionTypeEnum" RENAME TO "OptionTypeEnum_old"; -ALTER TYPE "OptionTypeEnum_new" RENAME TO "OptionTypeEnum"; -DROP TYPE "OptionTypeEnum_old"; -COMMIT; diff --git a/prisma/migrations/20240306212205_add_convertibles/migration.sql b/prisma/migrations/20240306212205_add_convertibles/migration.sql deleted file mode 100644 index 82ad2548c..000000000 --- a/prisma/migrations/20240306212205_add_convertibles/migration.sql +++ /dev/null @@ -1,108 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `notes` on the `Option` table. All the data in the column will be lost. - - You are about to drop the column `notes` on the `Share` table. All the data in the column will be lost. - -*/ --- CreateEnum -CREATE TYPE "SafeTypeEnum" AS ENUM ('PRE_MONEY', 'POST_MONEY', 'UNCAPPED'); - --- CreateEnum -CREATE TYPE "SafeStatusEnum" AS ENUM ('DRAFT', 'ACTIVE', 'PENDING', 'EXPIRED', 'CANCELLED'); - --- CreateEnum -CREATE TYPE "ConvertibleStatusEnum" AS ENUM ('DRAFT', 'ACTIVE', 'PENDING', 'EXPIRED', 'CANCELLED'); - --- CreateEnum -CREATE TYPE "ConvertibleTypeEnum" AS ENUM ('CCD', 'OCD', 'NOTE'); - --- CreateEnum -CREATE TYPE "ConvertibleInterestMethodEnum" AS ENUM ('SIMPLE', 'COMPOUND'); - --- CreateEnum -CREATE TYPE "ConvertibleInterestAccrualEnum" AS ENUM ('DAILY', 'MONTHLY', 'SEMI_ANNUALLY', 'ANNUALLY', 'YEARLY', 'CONTINUOUSLY'); - --- CreateEnum -CREATE TYPE "ConvertibleInterestPaymentScheduleEnum" AS ENUM ('DEFERRED', 'PAY_AT_MATURITY'); - --- AlterTable -ALTER TABLE "Document" ADD COLUMN "convertibleNoteId" TEXT, -ADD COLUMN "safeId" TEXT; - --- AlterTable -ALTER TABLE "Option" DROP COLUMN "notes"; - --- AlterTable -ALTER TABLE "Share" DROP COLUMN "notes"; - --- CreateTable -CREATE TABLE "Safe" ( - "id" TEXT NOT NULL, - "publicId" TEXT NOT NULL, - "type" "SafeTypeEnum" NOT NULL, - "status" "SafeStatusEnum" NOT NULL DEFAULT 'DRAFT', - "capital" DOUBLE PRECISION NOT NULL, - "valuationCap" DOUBLE PRECISION, - "discountRate" DOUBLE PRECISION, - "mfn" BOOLEAN, - "proRata" BOOLEAN, - "additionalTerms" TEXT, - "stakeholderId" TEXT NOT NULL, - "companyId" TEXT NOT NULL, - "issueDate" TIMESTAMP(3) NOT NULL, - "boardApprovalDate" TIMESTAMP(3) NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "Safe_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "ConvertibleNote" ( - "id" TEXT NOT NULL, - "publicId" TEXT NOT NULL, - "status" "ConvertibleStatusEnum" NOT NULL DEFAULT 'DRAFT', - "type" "ConvertibleTypeEnum" NOT NULL DEFAULT 'NOTE', - "capital" DOUBLE PRECISION NOT NULL, - "conversionCap" DOUBLE PRECISION, - "discountRate" DOUBLE PRECISION, - "mfn" BOOLEAN, - "additionalTerms" TEXT, - "interestRate" DOUBLE PRECISION, - "interestMethod" "ConvertibleInterestMethodEnum", - "interestAccrual" "ConvertibleInterestAccrualEnum", - "interestPaymentSchedule" "ConvertibleInterestPaymentScheduleEnum", - "stakeholderId" TEXT NOT NULL, - "companyId" TEXT NOT NULL, - "issueDate" TIMESTAMP(3) NOT NULL, - "boardApprovalDate" TIMESTAMP(3) NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "ConvertibleNote_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE INDEX "Safe_companyId_idx" ON "Safe"("companyId"); - --- CreateIndex -CREATE INDEX "Safe_stakeholderId_idx" ON "Safe"("stakeholderId"); - --- CreateIndex -CREATE UNIQUE INDEX "Safe_publicId_companyId_key" ON "Safe"("publicId", "companyId"); - --- CreateIndex -CREATE INDEX "ConvertibleNote_companyId_idx" ON "ConvertibleNote"("companyId"); - --- CreateIndex -CREATE INDEX "ConvertibleNote_stakeholderId_idx" ON "ConvertibleNote"("stakeholderId"); - --- CreateIndex -CREATE UNIQUE INDEX "ConvertibleNote_publicId_companyId_key" ON "ConvertibleNote"("publicId", "companyId"); - --- CreateIndex -CREATE INDEX "Document_safeId_idx" ON "Document"("safeId"); - --- CreateIndex -CREATE INDEX "Document_convertibleNoteId_idx" ON "Document"("convertibleNoteId"); diff --git a/prisma/migrations/20240313161813_added_grant_id_in_options/migration.sql b/prisma/migrations/20240313161813_added_grant_id_in_options/migration.sql deleted file mode 100644 index a7ae757ff..000000000 --- a/prisma/migrations/20240313161813_added_grant_id_in_options/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ -/* - Warnings: - - - Added the required column `grantId` to the `Option` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "Option" ADD COLUMN "grantId" TEXT NOT NULL; diff --git a/prisma/migrations/20240314200619_unique_grant_id_per_company/migration.sql b/prisma/migrations/20240314200619_unique_grant_id_per_company/migration.sql deleted file mode 100644 index 2000f78f3..000000000 --- a/prisma/migrations/20240314200619_unique_grant_id_per_company/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ -/* - Warnings: - - - A unique constraint covering the columns `[companyId,grantId]` on the table `Option` will be added. If there are existing duplicate values, this will fail. - -*/ --- CreateIndex -CREATE UNIQUE INDEX "Option_companyId_grantId_key" ON "Option"("companyId", "grantId"); diff --git a/prisma/migrations/20240316044930_add_safe_templates/migration.sql b/prisma/migrations/20240316044930_add_safe_templates/migration.sql deleted file mode 100644 index 14e680166..000000000 --- a/prisma/migrations/20240316044930_add_safe_templates/migration.sql +++ /dev/null @@ -1,26 +0,0 @@ -/* - Warnings: - - - The values [UNCAPPED] on the enum `SafeTypeEnum` will be removed. If these variants are still used in the database, this will fail. - - Made the column `mfn` on table `Safe` required. This step will fail if there are existing NULL values in that column. - - Made the column `proRata` on table `Safe` required. This step will fail if there are existing NULL values in that column. - -*/ --- CreateEnum -CREATE TYPE "YCSafeEnum" AS ENUM ('Valuation Cap, no Discount', 'Discount, no Valuation Cap', 'MFN, no Valuation Cap, no Discount', 'Valuation Cap, no Discount, include Pro Rata Rights', 'Discount, no Valuation Cap, include Pro Rata Rights', 'MFN, no Valuation Cap, no Discount, include Pro Rata Rights'); - --- AlterEnum -BEGIN; -CREATE TYPE "SafeTypeEnum_new" AS ENUM ('PRE_MONEY', 'POST_MONEY'); -ALTER TABLE "Safe" ALTER COLUMN "type" TYPE "SafeTypeEnum_new" USING ("type"::text::"SafeTypeEnum_new"); -ALTER TYPE "SafeTypeEnum" RENAME TO "SafeTypeEnum_old"; -ALTER TYPE "SafeTypeEnum_new" RENAME TO "SafeTypeEnum"; -DROP TYPE "SafeTypeEnum_old"; -COMMIT; - --- AlterTable -ALTER TABLE "Safe" ADD COLUMN "ycTemplate" "YCSafeEnum", -ALTER COLUMN "mfn" SET NOT NULL, -ALTER COLUMN "mfn" SET DEFAULT false, -ALTER COLUMN "proRata" SET NOT NULL, -ALTER COLUMN "proRata" SET DEFAULT false; diff --git a/prisma/migrations/20240316054731_make_post_money_default/migration.sql b/prisma/migrations/20240316054731_make_post_money_default/migration.sql deleted file mode 100644 index e96102a75..000000000 --- a/prisma/migrations/20240316054731_make_post_money_default/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE "Safe" ALTER COLUMN "type" SET DEFAULT 'POST_MONEY'; diff --git a/prisma/migrations/20240316062444_support_custom_safe_template/migration.sql b/prisma/migrations/20240316062444_support_custom_safe_template/migration.sql deleted file mode 100644 index 45f6764cd..000000000 --- a/prisma/migrations/20240316062444_support_custom_safe_template/migration.sql +++ /dev/null @@ -1,15 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `ycTemplate` on the `Safe` table. All the data in the column will be lost. - -*/ --- CreateEnum -CREATE TYPE "SafeTemplateEnum" AS ENUM ('Valuation Cap, no Discount', 'Discount, no Valuation Cap', 'MFN, no Valuation Cap, no Discount', 'Valuation Cap, no Discount, include Pro Rata Rights', 'Discount, no Valuation Cap, include Pro Rata Rights', 'MFN, no Valuation Cap, no Discount, include Pro Rata Rights', 'Custom'); - --- AlterTable -ALTER TABLE "Safe" DROP COLUMN "ycTemplate", -ADD COLUMN "safeTemplate" "SafeTemplateEnum"; - --- DropEnum -DROP TYPE "YCSafeEnum"; diff --git a/prisma/migrations/20240317081008_add_default_value_and_read_only/migration.sql b/prisma/migrations/20240317081008_add_default_value_and_read_only/migration.sql deleted file mode 100644 index 4e5af4e18..000000000 --- a/prisma/migrations/20240317081008_add_default_value_and_read_only/migration.sql +++ /dev/null @@ -1,10 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `placeholder` on the `TemplateField` table. All the data in the column will be lost. - -*/ --- AlterTable -ALTER TABLE "TemplateField" DROP COLUMN "placeholder", -ADD COLUMN "defaultValue" TEXT NOT NULL DEFAULT '', -ADD COLUMN "readOnly" BOOLEAN NOT NULL DEFAULT false; diff --git a/prisma/migrations/20240319052020_add_default_country/migration.sql b/prisma/migrations/20240319052020_add_default_country/migration.sql deleted file mode 100644 index 4545e2346..000000000 --- a/prisma/migrations/20240319052020_add_default_country/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE "Stakeholder" ADD COLUMN "country" TEXT NOT NULL DEFAULT 'US'; diff --git a/prisma/migrations/20240321052430_create_updates/migration.sql b/prisma/migrations/20240321052430_create_updates/migration.sql deleted file mode 100644 index a4327f5a2..000000000 --- a/prisma/migrations/20240321052430_create_updates/migration.sql +++ /dev/null @@ -1,47 +0,0 @@ --- CreateEnum -CREATE TYPE "UpdateEmailStatusEnum" AS ENUM ('SENT', 'PENDING', 'FAILED'); - --- CreateTable -CREATE TABLE "Updates" ( - "id" TEXT NOT NULL, - "publicId" TEXT NOT NULL, - "title" TEXT NOT NULL, - "content" JSONB NOT NULL, - "public" BOOLEAN NOT NULL DEFAULT false, - "companyId" TEXT NOT NULL, - "authorId" TEXT NOT NULL, - "sharedAt" TIMESTAMP(3), - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "Updates_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "UpdateRecipient" ( - "id" TEXT NOT NULL, - "stakeholderId" TEXT NOT NULL, - "updateId" TEXT NOT NULL, - "status" "UpdateEmailStatusEnum" NOT NULL DEFAULT 'PENDING', - "sentAt" TIMESTAMP(3), - "readAt" TIMESTAMP(3), - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "UpdateRecipient_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE INDEX "Updates_publicId_idx" ON "Updates"("publicId"); - --- CreateIndex -CREATE INDEX "Updates_authorId_idx" ON "Updates"("authorId"); - --- CreateIndex -CREATE INDEX "Updates_companyId_idx" ON "Updates"("companyId"); - --- CreateIndex -CREATE INDEX "UpdateRecipient_updateId_idx" ON "UpdateRecipient"("updateId"); - --- CreateIndex -CREATE INDEX "UpdateRecipient_stakeholderId_idx" ON "UpdateRecipient"("stakeholderId"); diff --git a/prisma/migrations/20240321061035_add_html_to_updates/migration.sql b/prisma/migrations/20240321061035_add_html_to_updates/migration.sql deleted file mode 100644 index f7cbd7d31..000000000 --- a/prisma/migrations/20240321061035_add_html_to_updates/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ -/* - Warnings: - - - Added the required column `html` to the `Updates` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "Updates" ADD COLUMN "html" TEXT NOT NULL; diff --git a/prisma/migrations/20240321063823_rename_public_to_is_public/migration.sql b/prisma/migrations/20240321063823_rename_public_to_is_public/migration.sql deleted file mode 100644 index 13257a1f2..000000000 --- a/prisma/migrations/20240321063823_rename_public_to_is_public/migration.sql +++ /dev/null @@ -1,9 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `public` on the `Updates` table. All the data in the column will be lost. - -*/ --- AlterTable -ALTER TABLE "Updates" DROP COLUMN "public", -ADD COLUMN "isPublic" BOOLEAN NOT NULL DEFAULT false; diff --git a/prisma/migrations/20240321064350_rename_updates_to_update/migration.sql b/prisma/migrations/20240321064350_rename_updates_to_update/migration.sql deleted file mode 100644 index a9826ffb7..000000000 --- a/prisma/migrations/20240321064350_rename_updates_to_update/migration.sql +++ /dev/null @@ -1,34 +0,0 @@ -/* - Warnings: - - - You are about to drop the `Updates` table. If the table is not empty, all the data it contains will be lost. - -*/ --- DropTable -DROP TABLE "Updates"; - --- CreateTable -CREATE TABLE "Update" ( - "id" TEXT NOT NULL, - "publicId" TEXT NOT NULL, - "title" TEXT NOT NULL, - "content" JSONB NOT NULL, - "html" TEXT NOT NULL, - "isPublic" BOOLEAN NOT NULL DEFAULT false, - "companyId" TEXT NOT NULL, - "authorId" TEXT NOT NULL, - "sharedAt" TIMESTAMP(3), - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "Update_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE INDEX "Update_publicId_idx" ON "Update"("publicId"); - --- CreateIndex -CREATE INDEX "Update_authorId_idx" ON "Update"("authorId"); - --- CreateIndex -CREATE INDEX "Update_companyId_idx" ON "Update"("companyId"); diff --git a/prisma/migrations/20240322062022_make_public_id_uniq/migration.sql b/prisma/migrations/20240322062022_make_public_id_uniq/migration.sql deleted file mode 100644 index 01a5b6e68..000000000 --- a/prisma/migrations/20240322062022_make_public_id_uniq/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ -/* - Warnings: - - - A unique constraint covering the columns `[publicId]` on the table `Update` will be added. If there are existing duplicate values, this will fail. - -*/ --- CreateIndex -CREATE UNIQUE INDEX "Update_publicId_key" ON "Update"("publicId"); diff --git a/prisma/migrations/20240323033041_add_company_logo/migration.sql b/prisma/migrations/20240323033041_add_company_logo/migration.sql deleted file mode 100644 index 258c08efb..000000000 --- a/prisma/migrations/20240323033041_add_company_logo/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE "Company" ADD COLUMN "logo" TEXT; diff --git a/prisma/migrations/20240331065543_update_shared_at_to_sent_at/migration.sql b/prisma/migrations/20240331065543_update_shared_at_to_sent_at/migration.sql deleted file mode 100644 index 1da10eaf8..000000000 --- a/prisma/migrations/20240331065543_update_shared_at_to_sent_at/migration.sql +++ /dev/null @@ -1,9 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `sharedAt` on the `Update` table. All the data in the column will be lost. - -*/ --- AlterTable -ALTER TABLE "Update" DROP COLUMN "sharedAt", -ADD COLUMN "sentAt" TIMESTAMP(3); diff --git a/prisma/migrations/20240401072542_update_status_enum/migration.sql b/prisma/migrations/20240401072542_update_status_enum/migration.sql deleted file mode 100644 index eaad374b8..000000000 --- a/prisma/migrations/20240401072542_update_status_enum/migration.sql +++ /dev/null @@ -1,12 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `isPublic` on the `Update` table. All the data in the column will be lost. - -*/ --- CreateEnum -CREATE TYPE "UpdateStatusEnum" AS ENUM ('DRAFT', 'PUBLIC', 'PRIVATE'); - --- AlterTable -ALTER TABLE "Update" DROP COLUMN "isPublic", -ADD COLUMN "status" "UpdateStatusEnum" NOT NULL DEFAULT 'DRAFT'; diff --git a/prisma/migrations/20240402041757_add_document_share/migration.sql b/prisma/migrations/20240402041757_add_document_share/migration.sql deleted file mode 100644 index 4b7c7c9f3..000000000 --- a/prisma/migrations/20240402041757_add_document_share/migration.sql +++ /dev/null @@ -1,13 +0,0 @@ --- CreateTable -CREATE TABLE "DocumentShare" ( - "id" TEXT NOT NULL, - "link" TEXT NOT NULL, - "expiresAt" TIMESTAMP(3) NOT NULL, - "recipients" JSONB, - "emailProtected" BOOLEAN NOT NULL DEFAULT false, - "documentId" TEXT NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "DocumentShare_pkey" PRIMARY KEY ("id") -); diff --git a/prisma/migrations/20240402050447_change_recipients_column_in_document_share/migration.sql b/prisma/migrations/20240402050447_change_recipients_column_in_document_share/migration.sql deleted file mode 100644 index 28b77352b..000000000 --- a/prisma/migrations/20240402050447_change_recipients_column_in_document_share/migration.sql +++ /dev/null @@ -1,9 +0,0 @@ -/* - Warnings: - - - The `recipients` column on the `DocumentShare` table would be dropped and recreated. This will lead to data loss if there is data in the column. - -*/ --- AlterTable -ALTER TABLE "DocumentShare" DROP COLUMN "recipients", -ADD COLUMN "recipients" TEXT[] DEFAULT ARRAY[]::TEXT[]; diff --git a/prisma/migrations/20240402050900_change_expires_at_to_link_expires_at_share_document/migration.sql b/prisma/migrations/20240402050900_change_expires_at_to_link_expires_at_share_document/migration.sql deleted file mode 100644 index 4e8bf5b29..000000000 --- a/prisma/migrations/20240402050900_change_expires_at_to_link_expires_at_share_document/migration.sql +++ /dev/null @@ -1,10 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `expiresAt` on the `DocumentShare` table. All the data in the column will be lost. - - Added the required column `linkExpiresAt` to the `DocumentShare` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "DocumentShare" DROP COLUMN "expiresAt", -ADD COLUMN "linkExpiresAt" TIMESTAMP(3) NOT NULL; diff --git a/prisma/migrations/20240407064117_add_public_id_to_document_share_table/migration.sql b/prisma/migrations/20240407064117_add_public_id_to_document_share_table/migration.sql deleted file mode 100644 index 611d333b9..000000000 --- a/prisma/migrations/20240407064117_add_public_id_to_document_share_table/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ -/* - Warnings: - - - Added the required column `publicId` to the `DocumentShare` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "DocumentShare" ADD COLUMN "publicId" TEXT NOT NULL; diff --git a/prisma/migrations/20240412090141_add_missing_index/migration.sql b/prisma/migrations/20240412090141_add_missing_index/migration.sql deleted file mode 100644 index 0be4fb609..000000000 --- a/prisma/migrations/20240412090141_add_missing_index/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- CreateIndex -CREATE INDEX "DocumentShare_documentId_idx" ON "DocumentShare"("documentId"); diff --git a/prisma/migrations/20240412204835_add_dataroom/migration.sql b/prisma/migrations/20240412204835_add_dataroom/migration.sql deleted file mode 100644 index 81793e0c8..000000000 --- a/prisma/migrations/20240412204835_add_dataroom/migration.sql +++ /dev/null @@ -1,52 +0,0 @@ --- CreateTable -CREATE TABLE "DataRoom" ( - "id" TEXT NOT NULL, - "name" TEXT NOT NULL, - "publicId" TEXT NOT NULL, - "public" BOOLEAN NOT NULL DEFAULT false, - "companyId" TEXT NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "DataRoom_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "DataRoomDocument" ( - "id" TEXT NOT NULL, - "dataRoomId" TEXT NOT NULL, - "documentId" TEXT NOT NULL, - - CONSTRAINT "DataRoomDocument_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "DataRoomRecipient" ( - "id" TEXT NOT NULL, - "email" TEXT NOT NULL, - "dataRoomId" TEXT NOT NULL, - "stakeholderId" TEXT, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - "expiresAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "DataRoomRecipient_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE INDEX "DataRoom_companyId_idx" ON "DataRoom"("companyId"); - --- CreateIndex -CREATE UNIQUE INDEX "DataRoom_publicId_key" ON "DataRoom"("publicId"); - --- CreateIndex -CREATE INDEX "DataRoomDocument_dataRoomId_idx" ON "DataRoomDocument"("dataRoomId"); - --- CreateIndex -CREATE INDEX "DataRoomDocument_documentId_idx" ON "DataRoomDocument"("documentId"); - --- CreateIndex -CREATE INDEX "DataRoomRecipient_dataRoomId_idx" ON "DataRoomRecipient"("dataRoomId"); - --- CreateIndex -CREATE INDEX "DataRoomRecipient_stakeholderId_idx" ON "DataRoomRecipient"("stakeholderId"); diff --git a/prisma/migrations/20240414050202_add_website_to_company/migration.sql b/prisma/migrations/20240414050202_add_website_to_company/migration.sql deleted file mode 100644 index 8504ebbc1..000000000 --- a/prisma/migrations/20240414050202_add_website_to_company/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE "Company" ADD COLUMN "website" TEXT; diff --git a/prisma/migrations/20240414052328_make_data_room_name_uniq_for_a_company/migration.sql b/prisma/migrations/20240414052328_make_data_room_name_uniq_for_a_company/migration.sql deleted file mode 100644 index 57b437a30..000000000 --- a/prisma/migrations/20240414052328_make_data_room_name_uniq_for_a_company/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ -/* - Warnings: - - - A unique constraint covering the columns `[companyId,name]` on the table `DataRoom` will be added. If there are existing duplicate values, this will fail. - -*/ --- CreateIndex -CREATE UNIQUE INDEX "DataRoom_companyId_name_key" ON "DataRoom"("companyId", "name"); diff --git a/prisma/migrations/20240414065518_add_member_to_data_room/migration.sql b/prisma/migrations/20240414065518_add_member_to_data_room/migration.sql deleted file mode 100644 index f757d5c3a..000000000 --- a/prisma/migrations/20240414065518_add_member_to_data_room/migration.sql +++ /dev/null @@ -1,5 +0,0 @@ --- AlterTable -ALTER TABLE "DataRoomRecipient" ADD COLUMN "memberId" TEXT; - --- CreateIndex -CREATE INDEX "DataRoomRecipient_memberId_idx" ON "DataRoomRecipient"("memberId"); diff --git a/prisma/migrations/20240416074225_data_room_created_timestamp/migration.sql b/prisma/migrations/20240416074225_data_room_created_timestamp/migration.sql deleted file mode 100644 index 26b0539e3..000000000 --- a/prisma/migrations/20240416074225_data_room_created_timestamp/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE "DataRoomDocument" ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP; diff --git a/prisma/migrations/20240416221402_uniq_data_room_documents/migration.sql b/prisma/migrations/20240416221402_uniq_data_room_documents/migration.sql deleted file mode 100644 index 422d0db93..000000000 --- a/prisma/migrations/20240416221402_uniq_data_room_documents/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ -/* - Warnings: - - - A unique constraint covering the columns `[dataRoomId,documentId]` on the table `DataRoomDocument` will be added. If there are existing duplicate values, this will fail. - -*/ --- CreateIndex -CREATE UNIQUE INDEX "DataRoomDocument_dataRoomId_documentId_key" ON "DataRoomDocument"("dataRoomId", "documentId"); diff --git a/prisma/migrations/20240416221945_make_expires_at_optional/migration.sql b/prisma/migrations/20240416221945_make_expires_at_optional/migration.sql deleted file mode 100644 index fc3017385..000000000 --- a/prisma/migrations/20240416221945_make_expires_at_optional/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE "DataRoomRecipient" ALTER COLUMN "expiresAt" DROP NOT NULL; diff --git a/prisma/migrations/20240421083719_implement_email_password_login_feature/migration.sql b/prisma/migrations/20240421083719_implement_email_password_login_feature/migration.sql deleted file mode 100644 index 02deccd25..000000000 --- a/prisma/migrations/20240421083719_implement_email_password_login_feature/migration.sql +++ /dev/null @@ -1,28 +0,0 @@ -/* - Warnings: - - - The required column `id` was added to the `VerificationToken` table with a prisma-level default value. This is not possible if the table is not empty. Please add this column as optional, then populate it before making it required. - -*/ --- AlterTable -ALTER TABLE "User" ADD COLUMN "password" TEXT; - --- AlterTable -ALTER TABLE "VerificationToken" ADD COLUMN "id" TEXT NOT NULL, -ADD CONSTRAINT "VerificationToken_pkey" PRIMARY KEY ("id"); - --- CreateTable -CREATE TABLE "PasswordResetToken" ( - "id" TEXT NOT NULL, - "email" TEXT NOT NULL, - "token" TEXT NOT NULL, - "expires" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "PasswordResetToken_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE UNIQUE INDEX "PasswordResetToken_token_key" ON "PasswordResetToken"("token"); - --- CreateIndex -CREATE UNIQUE INDEX "PasswordResetToken_email_token_key" ON "PasswordResetToken"("email", "token"); diff --git a/prisma/migrations/20240427153534_improve_esign_workflow/migration.sql b/prisma/migrations/20240427153534_improve_esign_workflow/migration.sql deleted file mode 100644 index 60e5bdf4a..000000000 --- a/prisma/migrations/20240427153534_improve_esign_workflow/migration.sql +++ /dev/null @@ -1,29 +0,0 @@ -/* - Warnings: - - - Added the required column `templateId` to the `EsignRecipient` table without a default value. This is not possible if the table is not empty. - - Made the column `email` on table `EsignRecipient` required. This step will fail if there are existing NULL values in that column. - - Added the required column `recipientId` to the `TemplateField` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "Document" ALTER COLUMN "uploaderId" DROP NOT NULL; - --- AlterTable -ALTER TABLE "EsignRecipient" ADD COLUMN "name" TEXT, -ADD COLUMN "templateId" TEXT NOT NULL, -ALTER COLUMN "email" SET NOT NULL; - --- AlterTable -ALTER TABLE "Template" ADD COLUMN "completedOn" TIMESTAMP(3), -ADD COLUMN "orderedDelivery" BOOLEAN NOT NULL DEFAULT false; - --- AlterTable -ALTER TABLE "TemplateField" ADD COLUMN "prefilledValue" TEXT, -ADD COLUMN "recipientId" TEXT NOT NULL; - --- CreateIndex -CREATE INDEX "EsignRecipient_templateId_idx" ON "EsignRecipient"("templateId"); - --- CreateIndex -CREATE INDEX "TemplateField_recipientId_idx" ON "TemplateField"("recipientId"); diff --git a/prisma/migrations/20240430070047_update_data_room_recipient/migration.sql b/prisma/migrations/20240430070047_update_data_room_recipient/migration.sql deleted file mode 100644 index e7513dbb6..000000000 --- a/prisma/migrations/20240430070047_update_data_room_recipient/migration.sql +++ /dev/null @@ -1,14 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `expiresAt` on the `DataRoomRecipient` table. All the data in the column will be lost. - - A unique constraint covering the columns `[dataRoomId,email]` on the table `DataRoomRecipient` will be added. If there are existing duplicate values, this will fail. - - Added the required column `name` to the `DataRoomRecipient` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "DataRoomRecipient" DROP COLUMN "expiresAt", -ADD COLUMN "name" TEXT NOT NULL; - --- CreateIndex -CREATE UNIQUE INDEX "DataRoomRecipient_dataRoomId_email_key" ON "DataRoomRecipient"("dataRoomId", "email"); diff --git a/prisma/migrations/20240430070149_make_name_optional/migration.sql b/prisma/migrations/20240430070149_make_name_optional/migration.sql deleted file mode 100644 index 71a57c6f9..000000000 --- a/prisma/migrations/20240430070149_make_name_optional/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE "DataRoomRecipient" ALTER COLUMN "name" DROP NOT NULL; diff --git a/prisma/migrations/20240501052622_index_public_id/migration.sql b/prisma/migrations/20240501052622_index_public_id/migration.sql deleted file mode 100644 index 72653cf18..000000000 --- a/prisma/migrations/20240501052622_index_public_id/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- CreateIndex -CREATE INDEX "DataRoom_publicId_idx" ON "DataRoom"("publicId"); diff --git a/prisma/migrations/20240501122457_esign_logs/migration.sql b/prisma/migrations/20240501122457_esign_logs/migration.sql deleted file mode 100644 index ec95bcba7..000000000 --- a/prisma/migrations/20240501122457_esign_logs/migration.sql +++ /dev/null @@ -1,25 +0,0 @@ --- CreateTable -CREATE TABLE "EsignAudit" ( - "id" TEXT NOT NULL, - "companyId" TEXT NOT NULL, - "templateId" TEXT NOT NULL, - "recipientId" TEXT NOT NULL, - "action" TEXT NOT NULL, - "ip" TEXT NOT NULL, - "userAgent" TEXT NOT NULL, - "location" TEXT NOT NULL, - "summary" TEXT NOT NULL, - "occurredAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "EsignAudit_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE INDEX "EsignAudit_companyId_idx" ON "EsignAudit"("companyId"); - --- CreateIndex -CREATE INDEX "EsignAudit_templateId_idx" ON "EsignAudit"("templateId"); - --- CreateIndex -CREATE INDEX "EsignAudit_recipientId_idx" ON "EsignAudit"("recipientId"); diff --git a/prisma/migrations/20240503082232_index_id_and_dataroomid/migration.sql b/prisma/migrations/20240503082232_index_id_and_dataroomid/migration.sql deleted file mode 100644 index af90e37bf..000000000 --- a/prisma/migrations/20240503082232_index_id_and_dataroomid/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- CreateIndex -CREATE INDEX "DataRoomRecipient_id_dataRoomId_idx" ON "DataRoomRecipient"("id", "dataRoomId"); diff --git a/prisma/migrations/20240504055008_optional_recipient/migration.sql b/prisma/migrations/20240504055008_optional_recipient/migration.sql deleted file mode 100644 index dfa035ddf..000000000 --- a/prisma/migrations/20240504055008_optional_recipient/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE "EsignAudit" ALTER COLUMN "recipientId" DROP NOT NULL; diff --git a/prisma/migrations/20240504130551_add_message_column_at_template/migration.sql b/prisma/migrations/20240504130551_add_message_column_at_template/migration.sql deleted file mode 100644 index c135fbf13..000000000 --- a/prisma/migrations/20240504130551_add_message_column_at_template/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE "Template" ADD COLUMN "message" TEXT; diff --git a/prisma/migrations/20240505021110_add_select/migration.sql b/prisma/migrations/20240505021110_add_select/migration.sql deleted file mode 100644 index 75a2acdf8..000000000 --- a/prisma/migrations/20240505021110_add_select/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterEnum -ALTER TYPE "FieldTypes" ADD VALUE 'SELECT'; diff --git a/prisma/migrations/20240507010943_add_meta_field/migration.sql b/prisma/migrations/20240507010943_add_meta_field/migration.sql deleted file mode 100644 index 47b79f305..000000000 --- a/prisma/migrations/20240507010943_add_meta_field/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE "TemplateField" ADD COLUMN "meta" JSONB NOT NULL DEFAULT '{}'; diff --git a/prisma/migrations/20240507044842_re_create_update_recipient/migration.sql b/prisma/migrations/20240507044842_re_create_update_recipient/migration.sql deleted file mode 100644 index 38fbc7765..000000000 --- a/prisma/migrations/20240507044842_re_create_update_recipient/migration.sql +++ /dev/null @@ -1,34 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `sentAt` on the `Update` table. All the data in the column will be lost. - - You are about to drop the column `readAt` on the `UpdateRecipient` table. All the data in the column will be lost. - - You are about to drop the column `sentAt` on the `UpdateRecipient` table. All the data in the column will be lost. - - You are about to drop the column `status` on the `UpdateRecipient` table. All the data in the column will be lost. - - A unique constraint covering the columns `[updateId,email]` on the table `UpdateRecipient` will be added. If there are existing duplicate values, this will fail. - - Added the required column `email` to the `UpdateRecipient` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "Update" DROP COLUMN "sentAt"; - --- AlterTable -ALTER TABLE "UpdateRecipient" DROP COLUMN "readAt", -DROP COLUMN "sentAt", -DROP COLUMN "status", -ADD COLUMN "email" TEXT NOT NULL, -ADD COLUMN "memberId" TEXT, -ADD COLUMN "name" TEXT, -ALTER COLUMN "stakeholderId" DROP NOT NULL; - --- DropEnum -DROP TYPE "UpdateEmailStatusEnum"; - --- CreateIndex -CREATE INDEX "UpdateRecipient_id_updateId_idx" ON "UpdateRecipient"("id", "updateId"); - --- CreateIndex -CREATE INDEX "UpdateRecipient_memberId_idx" ON "UpdateRecipient"("memberId"); - --- CreateIndex -CREATE UNIQUE INDEX "UpdateRecipient_updateId_email_key" ON "UpdateRecipient"("updateId", "email"); diff --git a/prisma/migrations/20240512165126_passkey_setup/migration.sql b/prisma/migrations/20240512165126_passkey_setup/migration.sql deleted file mode 100644 index 80fc92777..000000000 --- a/prisma/migrations/20240512165126_passkey_setup/migration.sql +++ /dev/null @@ -1,62 +0,0 @@ -/* - Warnings: - - - The primary key for the `VerificationToken` table will be changed. If it partially fails, the table could be left without primary key constraint. - - The `id` column on the `VerificationToken` table would be dropped and recreated. This will lead to data loss if there is data in the column. - - A unique constraint covering the columns `[secondaryId]` on the table `VerificationToken` will be added. If there are existing duplicate values, this will fail. - - The required column `secondaryId` was added to the `VerificationToken` table with a prisma-level default value. This is not possible if the table is not empty. Please add this column as optional, then populate it before making it required. - - Added the required column `userId` to the `VerificationToken` table without a default value. This is not possible if the table is not empty. - -*/ --- CreateEnum -CREATE TYPE "CredentialDeviceTypeEnum" AS ENUM ('SINGLE_DEVICE', 'MULTI_DEVICE'); - --- AlterTable -ALTER TABLE "User" ADD COLUMN "identityProvider" TEXT, -ADD COLUMN "lastSignedIn" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP; - --- AlterTable -ALTER TABLE "VerificationToken" DROP CONSTRAINT "VerificationToken_pkey", -ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, -ADD COLUMN "secondaryId" TEXT NOT NULL, -ADD COLUMN "userId" TEXT NOT NULL, -DROP COLUMN "id", -ADD COLUMN "id" SERIAL NOT NULL, -ADD CONSTRAINT "VerificationToken_pkey" PRIMARY KEY ("id"); - --- CreateTable -CREATE TABLE "Passkey" ( - "id" TEXT NOT NULL, - "userId" TEXT NOT NULL, - "name" TEXT NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "lastUsedAt" TIMESTAMP(3), - "credentialId" BYTEA NOT NULL, - "credentialPublicKey" BYTEA NOT NULL, - "counter" BIGINT NOT NULL, - "credentialDeviceType" "CredentialDeviceTypeEnum" NOT NULL, - "credentialBackedUp" BOOLEAN NOT NULL, - "transports" TEXT[], - - CONSTRAINT "Passkey_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "PasskeyVerificationToken" ( - "id" TEXT NOT NULL, - "token" TEXT NOT NULL, - "expiresAt" TIMESTAMP(3) NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "PasskeyVerificationToken_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE UNIQUE INDEX "PasskeyVerificationToken_id_key" ON "PasskeyVerificationToken"("id"); - --- CreateIndex -CREATE UNIQUE INDEX "PasskeyVerificationToken_token_key" ON "PasskeyVerificationToken"("token"); - --- CreateIndex -CREATE UNIQUE INDEX "VerificationToken_secondaryId_key" ON "VerificationToken"("secondaryId"); diff --git a/prisma/migrations/20240513040603_make_user_id_optional_in_verification_token_model/migration.sql b/prisma/migrations/20240513040603_make_user_id_optional_in_verification_token_model/migration.sql deleted file mode 100644 index 732d13ccd..000000000 --- a/prisma/migrations/20240513040603_make_user_id_optional_in_verification_token_model/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE "VerificationToken" ALTER COLUMN "userId" DROP NOT NULL; diff --git a/prisma/migrations/20240513073506_add_missing_index/migration.sql b/prisma/migrations/20240513073506_add_missing_index/migration.sql deleted file mode 100644 index 3d207e40d..000000000 --- a/prisma/migrations/20240513073506_add_missing_index/migration.sql +++ /dev/null @@ -1,5 +0,0 @@ --- CreateIndex -CREATE INDEX "Passkey_userId_idx" ON "Passkey"("userId"); - --- CreateIndex -CREATE INDEX "VerificationToken_userId_idx" ON "VerificationToken"("userId"); diff --git a/prisma/migrations/20240519093430_clean_migration/migration.sql b/prisma/migrations/20240519093430_clean_migration/migration.sql new file mode 100644 index 000000000..97500fc65 --- /dev/null +++ b/prisma/migrations/20240519093430_clean_migration/migration.sql @@ -0,0 +1,827 @@ +-- CreateEnum +CREATE TYPE "CredentialDeviceTypeEnum" AS ENUM ('SINGLE_DEVICE', 'MULTI_DEVICE'); + +-- CreateEnum +CREATE TYPE "MemberStatusEnum" AS ENUM ('ACTIVE', 'INACTIVE', 'PENDING'); + +-- CreateEnum +CREATE TYPE "StakeholderTypeEnum" AS ENUM ('INDIVIDUAL', 'INSTITUTION'); + +-- CreateEnum +CREATE TYPE "StakeholderRelationshipEnum" AS ENUM ('ADVISOR', 'BOARD_MEMBER', 'CONSULTANT', 'EMPLOYEE', 'EX_ADVISOR', 'EX_CONSULTANT', 'EX_EMPLOYEE', 'EXECUTIVE', 'FOUNDER', 'INVESTOR', 'NON_US_EMPLOYEE', 'OFFICER', 'OTHER'); + +-- CreateEnum +CREATE TYPE "ShareTypeEnum" AS ENUM ('COMMON', 'PREFERRED'); + +-- CreateEnum +CREATE TYPE "SharePrefixEnum" AS ENUM ('CS', 'PS'); + +-- CreateEnum +CREATE TYPE "ConversionRightsEnum" AS ENUM ('CONVERTS_TO_FUTURE_ROUND', 'CONVERTS_TO_SHARE_CLASS_ID'); + +-- CreateEnum +CREATE TYPE "CancellationBehaviorEnum" AS ENUM ('RETIRE', 'RETURN_TO_POOL', 'HOLD_AS_CAPITAL_STOCK', 'DEFINED_PER_PLAN_SECURITY'); + +-- CreateEnum +CREATE TYPE "FieldTypes" AS ENUM ('TEXT', 'RADIO', 'EMAIL', 'DATE', 'DATETIME', 'TEXTAREA', 'CHECKBOX', 'SIGNATURE', 'SELECT'); + +-- CreateEnum +CREATE TYPE "TemplateStatus" AS ENUM ('DRAFT', 'COMPLETE'); + +-- CreateEnum +CREATE TYPE "EsignRecipientStatus" AS ENUM ('SENT', 'SIGNED', 'PENDING'); + +-- CreateEnum +CREATE TYPE "SecuritiesStatusEnum" AS ENUM ('ACTIVE', 'DRAFT', 'SIGNED', 'PENDING'); + +-- CreateEnum +CREATE TYPE "VestingScheduleEnum" AS ENUM ('VESTING_0_0_0', 'VESTING_0_0_1', 'VESTING_4_1_0', 'VESTING_4_1_1', 'VESTING_4_3_1', 'VESTING_4_6_1', 'VESTING_4_12_1'); + +-- CreateEnum +CREATE TYPE "ShareLegendsEnum" AS ENUM ('US_SECURITIES_ACT', 'SALE_AND_ROFR', 'TRANSFER_RESTRICTIONS'); + +-- CreateEnum +CREATE TYPE "OptionTypeEnum" AS ENUM ('ISO', 'NSO', 'RSU'); + +-- CreateEnum +CREATE TYPE "OptionStatusEnum" AS ENUM ('DRAFT', 'ACTIVE', 'EXERCISED', 'EXPIRED', 'CANCELLED'); + +-- CreateEnum +CREATE TYPE "SafeTypeEnum" AS ENUM ('PRE_MONEY', 'POST_MONEY'); + +-- CreateEnum +CREATE TYPE "SafeStatusEnum" AS ENUM ('DRAFT', 'ACTIVE', 'PENDING', 'EXPIRED', 'CANCELLED'); + +-- CreateEnum +CREATE TYPE "SafeTemplateEnum" AS ENUM ('Valuation Cap, no Discount', 'Discount, no Valuation Cap', 'MFN, no Valuation Cap, no Discount', 'Valuation Cap, no Discount, include Pro Rata Rights', 'Discount, no Valuation Cap, include Pro Rata Rights', 'MFN, no Valuation Cap, no Discount, include Pro Rata Rights', 'Custom'); + +-- CreateEnum +CREATE TYPE "ConvertibleStatusEnum" AS ENUM ('DRAFT', 'ACTIVE', 'PENDING', 'EXPIRED', 'CANCELLED'); + +-- CreateEnum +CREATE TYPE "ConvertibleTypeEnum" AS ENUM ('CCD', 'OCD', 'NOTE'); + +-- CreateEnum +CREATE TYPE "ConvertibleInterestMethodEnum" AS ENUM ('SIMPLE', 'COMPOUND'); + +-- CreateEnum +CREATE TYPE "ConvertibleInterestAccrualEnum" AS ENUM ('DAILY', 'MONTHLY', 'SEMI_ANNUALLY', 'ANNUALLY', 'YEARLY', 'CONTINUOUSLY'); + +-- CreateEnum +CREATE TYPE "ConvertibleInterestPaymentScheduleEnum" AS ENUM ('DEFERRED', 'PAY_AT_MATURITY'); + +-- CreateEnum +CREATE TYPE "UpdateStatusEnum" AS ENUM ('DRAFT', 'PUBLIC', 'PRIVATE'); + +-- CreateTable +CREATE TABLE "Account" ( + "id" TEXT NOT NULL, + "userId" TEXT NOT NULL, + "type" TEXT NOT NULL, + "provider" TEXT NOT NULL, + "providerAccountId" TEXT NOT NULL, + "refresh_token" TEXT, + "access_token" TEXT, + "expires_at" INTEGER, + "token_type" TEXT, + "scope" TEXT, + "id_token" TEXT, + "session_state" TEXT, + + CONSTRAINT "Account_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "Session" ( + "id" TEXT NOT NULL, + "sessionToken" TEXT NOT NULL, + "userId" TEXT NOT NULL, + "expires" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "Session_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "User" ( + "id" TEXT NOT NULL, + "name" TEXT, + "email" TEXT, + "password" TEXT, + "emailVerified" TIMESTAMP(3), + "image" TEXT, + "lastSignedIn" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "identityProvider" TEXT, + + CONSTRAINT "User_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "Passkey" ( + "id" TEXT NOT NULL, + "name" TEXT NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "lastUsedAt" TIMESTAMP(3), + "credentialId" BYTEA NOT NULL, + "credentialPublicKey" BYTEA NOT NULL, + "counter" BIGINT NOT NULL, + "credentialDeviceType" "CredentialDeviceTypeEnum" NOT NULL, + "credentialBackedUp" BOOLEAN NOT NULL, + "transports" TEXT[], + "userId" TEXT NOT NULL, + + CONSTRAINT "Passkey_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "PasskeyVerificationToken" ( + "id" TEXT NOT NULL, + "token" TEXT NOT NULL, + "expiresAt" TIMESTAMP(3) NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + + CONSTRAINT "PasskeyVerificationToken_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "VerificationToken" ( + "id" SERIAL NOT NULL, + "secondaryId" TEXT NOT NULL, + "identifier" TEXT NOT NULL, + "token" TEXT NOT NULL, + "expires" TIMESTAMP(3) NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "userId" TEXT, + + CONSTRAINT "VerificationToken_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "PasswordResetToken" ( + "id" TEXT NOT NULL, + "email" TEXT NOT NULL, + "token" TEXT NOT NULL, + "expires" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "PasswordResetToken_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "Company" ( + "id" TEXT NOT NULL, + "name" TEXT NOT NULL, + "logo" TEXT, + "publicId" TEXT NOT NULL, + "website" TEXT, + "incorporationType" TEXT NOT NULL, + "incorporationDate" TIMESTAMP(3) NOT NULL, + "incorporationCountry" TEXT NOT NULL, + "incorporationState" TEXT NOT NULL, + "streetAddress" TEXT NOT NULL, + "city" TEXT NOT NULL, + "state" TEXT NOT NULL, + "zipcode" TEXT NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "Company_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "Member" ( + "id" TEXT NOT NULL, + "title" TEXT, + "status" "MemberStatusEnum" NOT NULL DEFAULT 'PENDING', + "isOnboarded" BOOLEAN NOT NULL DEFAULT false, + "workEmail" TEXT, + "lastAccessed" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + "userId" TEXT NOT NULL, + "companyId" TEXT NOT NULL, + + CONSTRAINT "Member_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "Stakeholder" ( + "id" TEXT NOT NULL, + "name" TEXT NOT NULL, + "email" TEXT NOT NULL, + "institutionName" TEXT, + "stakeholderType" "StakeholderTypeEnum" NOT NULL DEFAULT 'INDIVIDUAL', + "currentRelationship" "StakeholderRelationshipEnum" NOT NULL DEFAULT 'EMPLOYEE', + "taxId" TEXT, + "streetAddress" TEXT, + "city" TEXT, + "state" TEXT, + "zipcode" TEXT, + "country" TEXT NOT NULL DEFAULT 'US', + "companyId" TEXT NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "Stakeholder_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "Audit" ( + "id" TEXT NOT NULL, + "companyId" TEXT NOT NULL, + "summary" TEXT, + "action" TEXT NOT NULL, + "occurredAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "actor" JSONB NOT NULL, + "target" JSONB[], + "context" JSONB NOT NULL, + + CONSTRAINT "Audit_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "ShareClass" ( + "id" TEXT NOT NULL, + "idx" INTEGER NOT NULL, + "name" TEXT NOT NULL, + "classType" "ShareTypeEnum" NOT NULL DEFAULT 'COMMON', + "prefix" "SharePrefixEnum" NOT NULL DEFAULT 'CS', + "initialSharesAuthorized" BIGINT NOT NULL, + "boardApprovalDate" TIMESTAMP(3) NOT NULL, + "stockholderApprovalDate" TIMESTAMP(3) NOT NULL, + "votesPerShare" INTEGER NOT NULL, + "parValue" DOUBLE PRECISION NOT NULL, + "pricePerShare" DOUBLE PRECISION NOT NULL, + "seniority" INTEGER NOT NULL, + "conversionRights" "ConversionRightsEnum" NOT NULL DEFAULT 'CONVERTS_TO_FUTURE_ROUND', + "convertsToShareClassId" TEXT, + "liquidationPreferenceMultiple" DOUBLE PRECISION NOT NULL, + "participationCapMultiple" DOUBLE PRECISION NOT NULL, + "companyId" TEXT NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "ShareClass_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "EquityPlan" ( + "id" TEXT NOT NULL, + "name" TEXT NOT NULL, + "boardApprovalDate" TIMESTAMP(3) NOT NULL, + "planEffectiveDate" TIMESTAMP(3), + "initialSharesReserved" BIGINT NOT NULL, + "defaultCancellatonBehavior" "CancellationBehaviorEnum" NOT NULL, + "comments" TEXT, + "companyId" TEXT NOT NULL, + "shareClassId" TEXT NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "EquityPlan_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "Bucket" ( + "id" TEXT NOT NULL, + "name" TEXT NOT NULL, + "key" TEXT NOT NULL, + "mimeType" TEXT NOT NULL, + "size" INTEGER NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "Bucket_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "Document" ( + "id" TEXT NOT NULL, + "publicId" TEXT NOT NULL, + "name" TEXT NOT NULL, + "bucketId" TEXT NOT NULL, + "uploaderId" TEXT, + "companyId" TEXT NOT NULL, + "shareId" TEXT, + "optionId" TEXT, + "safeId" TEXT, + "convertibleNoteId" TEXT, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "Document_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "DataRoom" ( + "id" TEXT NOT NULL, + "name" TEXT NOT NULL, + "publicId" TEXT NOT NULL, + "public" BOOLEAN NOT NULL DEFAULT false, + "companyId" TEXT NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "DataRoom_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "DataRoomDocument" ( + "id" TEXT NOT NULL, + "dataRoomId" TEXT NOT NULL, + "documentId" TEXT NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + + CONSTRAINT "DataRoomDocument_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "DataRoomRecipient" ( + "id" TEXT NOT NULL, + "name" TEXT, + "email" TEXT NOT NULL, + "dataRoomId" TEXT NOT NULL, + "memberId" TEXT, + "stakeholderId" TEXT, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "DataRoomRecipient_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "UpdateRecipient" ( + "id" TEXT NOT NULL, + "name" TEXT, + "email" TEXT NOT NULL, + "updateId" TEXT NOT NULL, + "memberId" TEXT, + "stakeholderId" TEXT, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "UpdateRecipient_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "DocumentShare" ( + "id" TEXT NOT NULL, + "link" TEXT NOT NULL, + "publicId" TEXT NOT NULL, + "linkExpiresAt" TIMESTAMP(3) NOT NULL, + "recipients" TEXT[] DEFAULT ARRAY[]::TEXT[], + "emailProtected" BOOLEAN NOT NULL DEFAULT false, + "documentId" TEXT NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "DocumentShare_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "TemplateField" ( + "id" TEXT NOT NULL, + "name" TEXT NOT NULL, + "type" "FieldTypes" NOT NULL DEFAULT 'TEXT', + "defaultValue" TEXT NOT NULL DEFAULT '', + "readOnly" BOOLEAN NOT NULL DEFAULT false, + "required" BOOLEAN NOT NULL DEFAULT false, + "prefilledValue" TEXT, + "top" INTEGER NOT NULL, + "left" INTEGER NOT NULL, + "width" INTEGER NOT NULL, + "height" INTEGER NOT NULL, + "recipientId" TEXT NOT NULL, + "templateId" TEXT NOT NULL, + "viewportHeight" INTEGER NOT NULL, + "viewportWidth" INTEGER NOT NULL, + "page" INTEGER NOT NULL, + "meta" JSONB NOT NULL DEFAULT '{}', + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "TemplateField_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "Template" ( + "id" TEXT NOT NULL, + "publicId" TEXT NOT NULL, + "name" TEXT NOT NULL, + "status" "TemplateStatus" NOT NULL DEFAULT 'DRAFT', + "orderedDelivery" BOOLEAN NOT NULL DEFAULT false, + "message" TEXT, + "bucketId" TEXT NOT NULL, + "uploaderId" TEXT NOT NULL, + "companyId" TEXT NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + "completedOn" TIMESTAMP(3), + + CONSTRAINT "Template_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "EsignRecipient" ( + "id" TEXT NOT NULL, + "email" TEXT NOT NULL, + "name" TEXT, + "templateId" TEXT NOT NULL, + "status" "EsignRecipientStatus" NOT NULL DEFAULT 'PENDING', + "memberId" TEXT, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "EsignRecipient_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "Share" ( + "id" TEXT NOT NULL, + "status" "SecuritiesStatusEnum" NOT NULL DEFAULT 'DRAFT', + "certificateId" TEXT NOT NULL, + "quantity" INTEGER NOT NULL, + "pricePerShare" DOUBLE PRECISION, + "capitalContribution" DOUBLE PRECISION, + "ipContribution" DOUBLE PRECISION, + "debtCancelled" DOUBLE PRECISION, + "otherContributions" DOUBLE PRECISION, + "vestingSchedule" "VestingScheduleEnum" NOT NULL, + "companyLegends" "ShareLegendsEnum"[], + "issueDate" TIMESTAMP(3) NOT NULL, + "rule144Date" TIMESTAMP(3), + "vestingStartDate" TIMESTAMP(3), + "boardApprovalDate" TIMESTAMP(3) NOT NULL, + "stakeholderId" TEXT NOT NULL, + "companyId" TEXT NOT NULL, + "shareClassId" TEXT NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "Share_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "Option" ( + "id" TEXT NOT NULL, + "grantId" TEXT NOT NULL, + "quantity" INTEGER NOT NULL, + "exercisePrice" DOUBLE PRECISION NOT NULL, + "type" "OptionTypeEnum" NOT NULL, + "status" "OptionStatusEnum" NOT NULL DEFAULT 'DRAFT', + "vestingSchedule" "VestingScheduleEnum" NOT NULL, + "issueDate" TIMESTAMP(3) NOT NULL, + "expirationDate" TIMESTAMP(3) NOT NULL, + "vestingStartDate" TIMESTAMP(3) NOT NULL, + "boardApprovalDate" TIMESTAMP(3) NOT NULL, + "rule144Date" TIMESTAMP(3) NOT NULL, + "stakeholderId" TEXT NOT NULL, + "companyId" TEXT NOT NULL, + "equityPlanId" TEXT NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "Option_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "Investment" ( + "id" TEXT NOT NULL, + "amount" DOUBLE PRECISION NOT NULL, + "shares" BIGINT NOT NULL, + "date" TIMESTAMP(3) NOT NULL, + "comments" TEXT, + "shareClassId" TEXT NOT NULL, + "companyId" TEXT NOT NULL, + "stakeholderId" TEXT NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "Investment_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "Safe" ( + "id" TEXT NOT NULL, + "publicId" TEXT NOT NULL, + "type" "SafeTypeEnum" NOT NULL DEFAULT 'POST_MONEY', + "status" "SafeStatusEnum" NOT NULL DEFAULT 'DRAFT', + "capital" DOUBLE PRECISION NOT NULL, + "safeTemplate" "SafeTemplateEnum", + "valuationCap" DOUBLE PRECISION, + "discountRate" DOUBLE PRECISION, + "mfn" BOOLEAN NOT NULL DEFAULT false, + "proRata" BOOLEAN NOT NULL DEFAULT false, + "additionalTerms" TEXT, + "stakeholderId" TEXT NOT NULL, + "companyId" TEXT NOT NULL, + "issueDate" TIMESTAMP(3) NOT NULL, + "boardApprovalDate" TIMESTAMP(3) NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "Safe_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "ConvertibleNote" ( + "id" TEXT NOT NULL, + "publicId" TEXT NOT NULL, + "status" "ConvertibleStatusEnum" NOT NULL DEFAULT 'DRAFT', + "type" "ConvertibleTypeEnum" NOT NULL DEFAULT 'NOTE', + "capital" DOUBLE PRECISION NOT NULL, + "conversionCap" DOUBLE PRECISION, + "discountRate" DOUBLE PRECISION, + "mfn" BOOLEAN, + "additionalTerms" TEXT, + "interestRate" DOUBLE PRECISION, + "interestMethod" "ConvertibleInterestMethodEnum", + "interestAccrual" "ConvertibleInterestAccrualEnum", + "interestPaymentSchedule" "ConvertibleInterestPaymentScheduleEnum", + "stakeholderId" TEXT NOT NULL, + "companyId" TEXT NOT NULL, + "issueDate" TIMESTAMP(3) NOT NULL, + "boardApprovalDate" TIMESTAMP(3) NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "ConvertibleNote_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "Update" ( + "id" TEXT NOT NULL, + "publicId" TEXT NOT NULL, + "title" TEXT NOT NULL, + "content" JSONB NOT NULL, + "html" TEXT NOT NULL, + "status" "UpdateStatusEnum" NOT NULL DEFAULT 'DRAFT', + "authorId" TEXT NOT NULL, + "companyId" TEXT NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "Update_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "EsignAudit" ( + "id" TEXT NOT NULL, + "companyId" TEXT NOT NULL, + "templateId" TEXT NOT NULL, + "recipientId" TEXT, + "action" TEXT NOT NULL, + "ip" TEXT NOT NULL, + "userAgent" TEXT NOT NULL, + "location" TEXT NOT NULL, + "summary" TEXT NOT NULL, + "occurredAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "EsignAudit_pkey" PRIMARY KEY ("id") +); + +-- CreateIndex +CREATE INDEX "Account_userId_idx" ON "Account"("userId"); + +-- CreateIndex +CREATE UNIQUE INDEX "Account_provider_providerAccountId_key" ON "Account"("provider", "providerAccountId"); + +-- CreateIndex +CREATE UNIQUE INDEX "Session_sessionToken_key" ON "Session"("sessionToken"); + +-- CreateIndex +CREATE INDEX "Session_userId_idx" ON "Session"("userId"); + +-- CreateIndex +CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); + +-- CreateIndex +CREATE INDEX "Passkey_userId_idx" ON "Passkey"("userId"); + +-- CreateIndex +CREATE UNIQUE INDEX "PasskeyVerificationToken_id_key" ON "PasskeyVerificationToken"("id"); + +-- CreateIndex +CREATE UNIQUE INDEX "PasskeyVerificationToken_token_key" ON "PasskeyVerificationToken"("token"); + +-- CreateIndex +CREATE UNIQUE INDEX "VerificationToken_secondaryId_key" ON "VerificationToken"("secondaryId"); + +-- CreateIndex +CREATE UNIQUE INDEX "VerificationToken_token_key" ON "VerificationToken"("token"); + +-- CreateIndex +CREATE INDEX "VerificationToken_userId_idx" ON "VerificationToken"("userId"); + +-- CreateIndex +CREATE UNIQUE INDEX "VerificationToken_identifier_token_key" ON "VerificationToken"("identifier", "token"); + +-- CreateIndex +CREATE UNIQUE INDEX "PasswordResetToken_token_key" ON "PasswordResetToken"("token"); + +-- CreateIndex +CREATE UNIQUE INDEX "PasswordResetToken_email_token_key" ON "PasswordResetToken"("email", "token"); + +-- CreateIndex +CREATE UNIQUE INDEX "Company_publicId_key" ON "Company"("publicId"); + +-- CreateIndex +CREATE INDEX "Member_companyId_idx" ON "Member"("companyId"); + +-- CreateIndex +CREATE INDEX "Member_status_idx" ON "Member"("status"); + +-- CreateIndex +CREATE INDEX "Member_userId_idx" ON "Member"("userId"); + +-- CreateIndex +CREATE UNIQUE INDEX "Member_companyId_userId_key" ON "Member"("companyId", "userId"); + +-- CreateIndex +CREATE UNIQUE INDEX "Stakeholder_email_key" ON "Stakeholder"("email"); + +-- CreateIndex +CREATE INDEX "Stakeholder_companyId_idx" ON "Stakeholder"("companyId"); + +-- CreateIndex +CREATE INDEX "Audit_companyId_idx" ON "Audit"("companyId"); + +-- CreateIndex +CREATE INDEX "ShareClass_companyId_idx" ON "ShareClass"("companyId"); + +-- CreateIndex +CREATE UNIQUE INDEX "ShareClass_companyId_idx_key" ON "ShareClass"("companyId", "idx"); + +-- CreateIndex +CREATE INDEX "EquityPlan_shareClassId_idx" ON "EquityPlan"("shareClassId"); + +-- CreateIndex +CREATE INDEX "EquityPlan_companyId_idx" ON "EquityPlan"("companyId"); + +-- CreateIndex +CREATE INDEX "Document_bucketId_idx" ON "Document"("bucketId"); + +-- CreateIndex +CREATE INDEX "Document_uploaderId_idx" ON "Document"("uploaderId"); + +-- CreateIndex +CREATE INDEX "Document_companyId_idx" ON "Document"("companyId"); + +-- CreateIndex +CREATE INDEX "Document_shareId_idx" ON "Document"("shareId"); + +-- CreateIndex +CREATE INDEX "Document_optionId_idx" ON "Document"("optionId"); + +-- CreateIndex +CREATE INDEX "Document_safeId_idx" ON "Document"("safeId"); + +-- CreateIndex +CREATE INDEX "Document_convertibleNoteId_idx" ON "Document"("convertibleNoteId"); + +-- CreateIndex +CREATE UNIQUE INDEX "Document_publicId_key" ON "Document"("publicId"); + +-- CreateIndex +CREATE INDEX "DataRoom_publicId_idx" ON "DataRoom"("publicId"); + +-- CreateIndex +CREATE INDEX "DataRoom_companyId_idx" ON "DataRoom"("companyId"); + +-- CreateIndex +CREATE UNIQUE INDEX "DataRoom_publicId_key" ON "DataRoom"("publicId"); + +-- CreateIndex +CREATE UNIQUE INDEX "DataRoom_companyId_name_key" ON "DataRoom"("companyId", "name"); + +-- CreateIndex +CREATE INDEX "DataRoomDocument_dataRoomId_idx" ON "DataRoomDocument"("dataRoomId"); + +-- CreateIndex +CREATE INDEX "DataRoomDocument_documentId_idx" ON "DataRoomDocument"("documentId"); + +-- CreateIndex +CREATE UNIQUE INDEX "DataRoomDocument_dataRoomId_documentId_key" ON "DataRoomDocument"("dataRoomId", "documentId"); + +-- CreateIndex +CREATE INDEX "DataRoomRecipient_id_dataRoomId_idx" ON "DataRoomRecipient"("id", "dataRoomId"); + +-- CreateIndex +CREATE INDEX "DataRoomRecipient_memberId_idx" ON "DataRoomRecipient"("memberId"); + +-- CreateIndex +CREATE INDEX "DataRoomRecipient_dataRoomId_idx" ON "DataRoomRecipient"("dataRoomId"); + +-- CreateIndex +CREATE INDEX "DataRoomRecipient_stakeholderId_idx" ON "DataRoomRecipient"("stakeholderId"); + +-- CreateIndex +CREATE UNIQUE INDEX "DataRoomRecipient_dataRoomId_email_key" ON "DataRoomRecipient"("dataRoomId", "email"); + +-- CreateIndex +CREATE INDEX "UpdateRecipient_id_updateId_idx" ON "UpdateRecipient"("id", "updateId"); + +-- CreateIndex +CREATE INDEX "UpdateRecipient_memberId_idx" ON "UpdateRecipient"("memberId"); + +-- CreateIndex +CREATE INDEX "UpdateRecipient_updateId_idx" ON "UpdateRecipient"("updateId"); + +-- CreateIndex +CREATE INDEX "UpdateRecipient_stakeholderId_idx" ON "UpdateRecipient"("stakeholderId"); + +-- CreateIndex +CREATE UNIQUE INDEX "UpdateRecipient_updateId_email_key" ON "UpdateRecipient"("updateId", "email"); + +-- CreateIndex +CREATE INDEX "DocumentShare_documentId_idx" ON "DocumentShare"("documentId"); + +-- CreateIndex +CREATE INDEX "TemplateField_templateId_idx" ON "TemplateField"("templateId"); + +-- CreateIndex +CREATE INDEX "TemplateField_recipientId_idx" ON "TemplateField"("recipientId"); + +-- CreateIndex +CREATE INDEX "Template_bucketId_idx" ON "Template"("bucketId"); + +-- CreateIndex +CREATE INDEX "Template_uploaderId_idx" ON "Template"("uploaderId"); + +-- CreateIndex +CREATE INDEX "Template_companyId_idx" ON "Template"("companyId"); + +-- CreateIndex +CREATE INDEX "EsignRecipient_memberId_idx" ON "EsignRecipient"("memberId"); + +-- CreateIndex +CREATE INDEX "EsignRecipient_templateId_idx" ON "EsignRecipient"("templateId"); + +-- CreateIndex +CREATE INDEX "Share_companyId_idx" ON "Share"("companyId"); + +-- CreateIndex +CREATE INDEX "Share_shareClassId_idx" ON "Share"("shareClassId"); + +-- CreateIndex +CREATE INDEX "Share_stakeholderId_idx" ON "Share"("stakeholderId"); + +-- CreateIndex +CREATE INDEX "Option_companyId_idx" ON "Option"("companyId"); + +-- CreateIndex +CREATE INDEX "Option_equityPlanId_idx" ON "Option"("equityPlanId"); + +-- CreateIndex +CREATE INDEX "Option_stakeholderId_idx" ON "Option"("stakeholderId"); + +-- CreateIndex +CREATE UNIQUE INDEX "Option_companyId_grantId_key" ON "Option"("companyId", "grantId"); + +-- CreateIndex +CREATE INDEX "Investment_companyId_idx" ON "Investment"("companyId"); + +-- CreateIndex +CREATE INDEX "Investment_stakeholderId_idx" ON "Investment"("stakeholderId"); + +-- CreateIndex +CREATE INDEX "Investment_shareClassId_idx" ON "Investment"("shareClassId"); + +-- CreateIndex +CREATE INDEX "Safe_companyId_idx" ON "Safe"("companyId"); + +-- CreateIndex +CREATE INDEX "Safe_stakeholderId_idx" ON "Safe"("stakeholderId"); + +-- CreateIndex +CREATE UNIQUE INDEX "Safe_publicId_companyId_key" ON "Safe"("publicId", "companyId"); + +-- CreateIndex +CREATE INDEX "ConvertibleNote_companyId_idx" ON "ConvertibleNote"("companyId"); + +-- CreateIndex +CREATE INDEX "ConvertibleNote_stakeholderId_idx" ON "ConvertibleNote"("stakeholderId"); + +-- CreateIndex +CREATE UNIQUE INDEX "ConvertibleNote_publicId_companyId_key" ON "ConvertibleNote"("publicId", "companyId"); + +-- CreateIndex +CREATE INDEX "Update_publicId_idx" ON "Update"("publicId"); + +-- CreateIndex +CREATE INDEX "Update_authorId_idx" ON "Update"("authorId"); + +-- CreateIndex +CREATE INDEX "Update_companyId_idx" ON "Update"("companyId"); + +-- CreateIndex +CREATE UNIQUE INDEX "Update_publicId_key" ON "Update"("publicId"); + +-- CreateIndex +CREATE INDEX "EsignAudit_companyId_idx" ON "EsignAudit"("companyId"); + +-- CreateIndex +CREATE INDEX "EsignAudit_templateId_idx" ON "EsignAudit"("templateId"); + +-- CreateIndex +CREATE INDEX "EsignAudit_recipientId_idx" ON "EsignAudit"("recipientId"); From 33cf218de8f88e3f80299e9cfb4397431ad16eaa Mon Sep 17 00:00:00 2001 From: Puru D Date: Sun, 19 May 2024 05:13:43 -0500 Subject: [PATCH 08/14] feat: run sendAuthVerificationEmail sync, so people dont have to wait for it --- src/trpc/routers/auth/procedure/resend-email.ts | 5 +++-- src/trpc/routers/auth/procedure/signup.ts | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/trpc/routers/auth/procedure/resend-email.ts b/src/trpc/routers/auth/procedure/resend-email.ts index 3a0ab4f0a..24260cbc1 100644 --- a/src/trpc/routers/auth/procedure/resend-email.ts +++ b/src/trpc/routers/auth/procedure/resend-email.ts @@ -1,4 +1,4 @@ -import { AuthVerificationEmailJob } from "@/jobs/auth-verification-email"; +import { sendAuthVerificationEmail } from "@/jobs/auth-verification-email"; import { generateVerificationToken } from "@/lib/token"; import { getVerificationTokenByEmail } from "@/server/verification-token"; @@ -19,10 +19,11 @@ export const resendEmailProcedure = withoutAuth } const verificationToken = await generateVerificationToken(input); - await new AuthVerificationEmailJob().emit({ + await sendAuthVerificationEmail({ email: verificationToken.identifier, token: verificationToken.token, }); + return { success: true, message: diff --git a/src/trpc/routers/auth/procedure/signup.ts b/src/trpc/routers/auth/procedure/signup.ts index addd96f0f..9a91b1706 100644 --- a/src/trpc/routers/auth/procedure/signup.ts +++ b/src/trpc/routers/auth/procedure/signup.ts @@ -1,4 +1,4 @@ -import { AuthVerificationEmailJob } from "@/jobs/auth-verification-email"; +import { sendAuthVerificationEmail } from "@/jobs/auth-verification-email"; import { generateVerificationToken } from "@/lib/token"; import { withoutAuth } from "@/trpc/api/trpc"; @@ -35,7 +35,7 @@ export const signupProcedure = withoutAuth }); const verificationToken = await generateVerificationToken(email); - await new AuthVerificationEmailJob().emit({ + await sendAuthVerificationEmail({ email: verificationToken.identifier, token: verificationToken.token, }); From 3f76cadc54a6e22aee10704b32ba68cd3418dfde Mon Sep 17 00:00:00 2001 From: Puru D Date: Sun, 19 May 2024 06:02:37 -0500 Subject: [PATCH 09/14] chore: debugging sending email --- .env.example | 2 +- src/jobs/auth-verification-email.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index c73c01da1..b81c8017e 100644 --- a/.env.example +++ b/.env.example @@ -31,7 +31,7 @@ GOOGLE_CLIENT_SECRET="xxxxxxxxxx" # SMTP EMAIL_FROM="'Captable, Inc.' " -EMAIL_SERVER=smtp://captable:password@127.0.0.1:2500 +EMAIL_SERVER=smtp://captable:password@localhost:1025 # Uploads UPLOAD_ENDPOINT="http://127.0.0.1:9002" diff --git a/src/jobs/auth-verification-email.ts b/src/jobs/auth-verification-email.ts index 7ae583aa8..4c7a9c417 100644 --- a/src/jobs/auth-verification-email.ts +++ b/src/jobs/auth-verification-email.ts @@ -18,6 +18,8 @@ export const sendAuthVerificationEmail = async ( const confirmLink = `${baseUrl}/verify-email/${token}`; + console.log("Sending email to ", email, "with link ", confirmLink); + const html = await render( AccountVerificationEmail({ verifyLink: confirmLink, From 5b58a70b0cc123fc2f72a817517380b09affcac7 Mon Sep 17 00:00:00 2001 From: Puru D Date: Mon, 20 May 2024 00:22:13 -0500 Subject: [PATCH 10/14] fix: onboarding form --- .../20240520051518_add_country/migration.sql | 8 + prisma/schema.prisma | 1 + src/components/onboarding/company-form.tsx | 151 +++++++++++------- src/trpc/routers/onboarding-router/schema.ts | 3 + 4 files changed, 105 insertions(+), 58 deletions(-) create mode 100644 prisma/migrations/20240520051518_add_country/migration.sql diff --git a/prisma/migrations/20240520051518_add_country/migration.sql b/prisma/migrations/20240520051518_add_country/migration.sql new file mode 100644 index 000000000..76229a53a --- /dev/null +++ b/prisma/migrations/20240520051518_add_country/migration.sql @@ -0,0 +1,8 @@ +/* + Warnings: + + - Added the required column `country` to the `Company` table without a default value. This is not possible if the table is not empty. + +*/ +-- AlterTable +ALTER TABLE "Company" ADD COLUMN "country" TEXT NOT NULL; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 88177b1a8..952074821 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -135,6 +135,7 @@ model Company { city String state String zipcode String + country String createdAt DateTime @default(now()) updatedAt DateTime @updatedAt diff --git a/src/components/onboarding/company-form.tsx b/src/components/onboarding/company-form.tsx index e870fd15b..e3b6344dc 100644 --- a/src/components/onboarding/company-form.tsx +++ b/src/components/onboarding/company-form.tsx @@ -33,7 +33,7 @@ import { useToast } from "@/components/ui/use-toast"; import countries from "@/lib/countries"; import { cn, isFileExists, validateFile } from "@/lib/utils"; import { api } from "@/trpc/react"; -import { type RouterOutputs } from "@/trpc/shared"; +import type { RouterOutputs } from "@/trpc/shared"; import { useSession } from "next-auth/react"; import { useRouter } from "next/navigation"; import { useRef, useState } from "react"; @@ -316,33 +316,21 @@ export const CompanyForm = ({ type, data }: CompanyFormProps) => {
-

Company incorporation details

+

Company address

- Please provide your company{`'`}s incorporation details. Your - certificate of incorporation will come in handy here. + Please provide your company{`'`}s address.

( - Incorporation type - + Street address + + + )} @@ -350,12 +338,12 @@ export const CompanyForm = ({ type, data }: CompanyFormProps) => { ( - Incorporation date + City - + @@ -363,13 +351,41 @@ export const CompanyForm = ({ type, data }: CompanyFormProps) => { />
-
+
( - Incorporation country + State + + + + + + )} + /> + + ( + + Postal code + + + + + + )} + /> + + ( + + Country - - - - )} - />
- {/* */} -

Company address

+
+ +

Company incorporation details

- Please provide your company{`'`}s address. + Please provide your company{`'`}s incorporation details. Your + certificate of incorporation will come in handy here.

( - Street address - - - + Incorporation type + )} @@ -429,12 +451,12 @@ export const CompanyForm = ({ type, data }: CompanyFormProps) => { ( - City + Incorporation date - + @@ -445,13 +467,26 @@ export const CompanyForm = ({ type, data }: CompanyFormProps) => {
( - State - - - + Incorporation country + )} @@ -459,10 +494,10 @@ export const CompanyForm = ({ type, data }: CompanyFormProps) => { ( - Zipcode + Incorporation state diff --git a/src/trpc/routers/onboarding-router/schema.ts b/src/trpc/routers/onboarding-router/schema.ts index 459ac7d73..5198c6d6d 100644 --- a/src/trpc/routers/onboarding-router/schema.ts +++ b/src/trpc/routers/onboarding-router/schema.ts @@ -47,6 +47,9 @@ export const ZodCompanyMutationSchema = z.object({ zipcode: z.string().min(1, { message: "Zipcode is required", }), + country: z.string().min(1, { + message: "Country is required", + }), logo: z.string().min(1).optional(), }), }); From 880a97d835a72870ea4482e34b34ed9ff280be9b Mon Sep 17 00:00:00 2001 From: Puru D Date: Mon, 20 May 2024 00:39:29 -0500 Subject: [PATCH 11/14] feat: fix some linting issues --- prisma/seeds/companies.ts | 7 ++++--- src/components/update/editor.tsx | 21 +++++++++++---------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/prisma/seeds/companies.ts b/prisma/seeds/companies.ts index a259f050f..4f24b99bf 100644 --- a/prisma/seeds/companies.ts +++ b/prisma/seeds/companies.ts @@ -1,8 +1,8 @@ import { generatePublicId } from "@/common/id"; -import { faker } from "@faker-js/faker"; import { db } from "@/server/db"; -import { sample } from "lodash-es"; +import { faker } from "@faker-js/faker"; import colors from "colors"; +import { sample } from "lodash-es"; colors.enable(); type CompanyType = { @@ -17,8 +17,8 @@ type CompanyType = { city: string; state: string; zipcode: string; + country: string; }; - const seedCompanies = async (count = 4) => { const companies: CompanyType[] = []; @@ -35,6 +35,7 @@ const seedCompanies = async (count = 4) => { city: faker.location.city(), state: faker.location.state({ abbreviated: true }), zipcode: faker.location.zipCode(), + country: faker.location.countryCode(), }); } diff --git a/src/components/update/editor.tsx b/src/components/update/editor.tsx index 85cb0b1af..bec375d14 100644 --- a/src/components/update/editor.tsx +++ b/src/components/update/editor.tsx @@ -12,17 +12,17 @@ import { DropdownButton } from "@/components/ui/dropdown-button"; import { useToast } from "@/components/ui/use-toast"; import type { ShareContactType, ShareRecipientType } from "@/schema/contacts"; import { api } from "@/trpc/react"; -import { type Block } from "@blocknote/core"; +import type { Block } from "@blocknote/core"; import type { Update } from "@prisma/client"; import { RiArrowDownSLine } from "@remixicon/react"; import Link from "next/link"; import { useRouter } from "next/navigation"; import { Fragment, useState } from "react"; -import { env } from "@/env"; import "@/styles/editor.css"; import { BlockNoteView, useCreateBlockNote } from "@blocknote/react"; import "@blocknote/react/style.css"; +import { env } from "next-runtime-env"; type UpdatesEditorProps = { update?: Update; @@ -41,7 +41,7 @@ const UpdatesEditor = ({ }: UpdatesEditorProps) => { const router = useRouter(); const { toast } = useToast(); - const baseUrl = env.NEXT_PUBLIC_BASE_URL; + const baseUrl = env("NEXT_PUBLIC_BASE_URL"); const date = new Date(); const formattedDate = dayjsExt(date).format("MMM YYYY"); @@ -181,7 +181,7 @@ const UpdatesEditor = ({ }); const draftMutation = api.update.save.useMutation({ - onSuccess: async ({ publicId, success, message }) => { + onSuccess: ({ publicId, success, message }) => { toast({ variant: success ? "default" : "destructive", title: success @@ -213,7 +213,7 @@ const UpdatesEditor = ({ }); const cloneMutation = api.update.clone.useMutation({ - onSuccess: async ({ publicId, success, message }) => { + onSuccess: ({ publicId, success, message }) => { toast({ variant: success ? "default" : "destructive", title: success @@ -240,7 +240,7 @@ const UpdatesEditor = ({ }, }); - const saveAsDraft = async () => { + const saveAsDraft = () => { setLoading(true); const data = { @@ -253,7 +253,7 @@ const UpdatesEditor = ({ draftMutation.mutate(data); }; - const cloneUpdate = async () => { + const cloneUpdate = () => { setLoading(true); const data = { @@ -261,6 +261,7 @@ const UpdatesEditor = ({ html, content, }; + cloneMutation.mutate(data); }; @@ -367,11 +368,11 @@ const UpdatesEditor = ({ */} - {update && mode === "edit" && ( + {update && mode === "edit" && recipients && contacts && (
  • Date: Mon, 20 May 2024 01:42:13 -0500 Subject: [PATCH 12/14] feat: update docs --- .github/workflows/release.yml | 7 ++----- SELF-HOSTING.md | 2 ++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fbfcc7066..07c5b15d2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,11 +1,8 @@ name: Production on: - # release: - # types: [published] - push: - branches: - - debug + release: + types: [published] jobs: push_to_registries: diff --git a/SELF-HOSTING.md b/SELF-HOSTING.md index 9d92015a4..ca9942c6f 100644 --- a/SELF-HOSTING.md +++ b/SELF-HOSTING.md @@ -28,6 +28,8 @@ NEXT_PUBLIC_BASE_URL="https://your-domain.com" # Email server environment variables EMAIL_FROM="your@email.com" + +# Please use encrypted/TLS connection for SMTP server. EMAIL_SERVER="smtp://username:password@host:port" # File uplod environment variables From df0b130c3cb36ee9b3d07001f8cff3c615bc4f1d Mon Sep 17 00:00:00 2001 From: Puru D Date: Mon, 20 May 2024 01:46:42 -0500 Subject: [PATCH 13/14] WIP - captable page --- .../(dashboard)/[publicId]/overview/page.tsx | 68 +++++++++++++++++ .../(dashboard)/[publicId]/page.tsx | 74 ++++--------------- 2 files changed, 82 insertions(+), 60 deletions(-) create mode 100644 src/app/(authenticated)/(dashboard)/[publicId]/overview/page.tsx diff --git a/src/app/(authenticated)/(dashboard)/[publicId]/overview/page.tsx b/src/app/(authenticated)/(dashboard)/[publicId]/overview/page.tsx new file mode 100644 index 000000000..6e552721a --- /dev/null +++ b/src/app/(authenticated)/(dashboard)/[publicId]/overview/page.tsx @@ -0,0 +1,68 @@ +import ActivitiesCard from "@/components/dashboard/overview/activities-card"; +import DonutCard from "@/components/dashboard/overview/donut-card"; +import SummaryTable from "@/components/dashboard/overview/summary-table"; +import OverviewCard from "@/components/dashboard/overview/top-card"; +import type { Metadata } from "next"; + +export const metadata: Metadata = { + title: "Overview", +}; + +const OverviewPage = ({ + params: { publicId }, +}: { + params: { publicId: string }; +}) => { + return ( + <> + {/* */} + +
    +

    Overview

    +

    + View your company{`'`}s captable overview +

    +
    + +
    +
    + {/* Overview */} +
    +
    + + + +
    +
    + + {/* Tremor chart */} +
    + +
    +
    + +
    + +
    +
    + +
    +

    Summary

    +

    + Summary of your company{`'`}s captable +

    + + +
    + + ); +}; + +export default OverviewPage; diff --git a/src/app/(authenticated)/(dashboard)/[publicId]/page.tsx b/src/app/(authenticated)/(dashboard)/[publicId]/page.tsx index eaeeaab6c..4e75ea48c 100644 --- a/src/app/(authenticated)/(dashboard)/[publicId]/page.tsx +++ b/src/app/(authenticated)/(dashboard)/[publicId]/page.tsx @@ -1,68 +1,22 @@ -import ActivitiesCard from "@/components/dashboard/overview/activities-card"; -import DonutCard from "@/components/dashboard/overview/donut-card"; -import SummaryTable from "@/components/dashboard/overview/summary-table"; -import OverviewCard from "@/components/dashboard/overview/top-card"; -import { type Metadata } from "next"; +import EmptyState from "@/components/common/empty-state"; +import { Button } from "@/components/ui/button"; +import { RiPieChartFill } from "@remixicon/react"; +import type { Metadata } from "next"; export const metadata: Metadata = { - title: "Overview", + title: "Cap table", }; -const OverviewPage = ({ - params: { publicId }, -}: { - params: { publicId: string }; -}) => { +const CaptablePage = () => { return ( - <> - {/* */} - -
    -

    Overview

    -

    - View your company{`'`}s captable overview -

    -
    - -
    -
    - {/* Overview */} -
    -
    - - - -
    -
    - - {/* Tremor chart */} -
    - -
    -
    - -
    - -
    -
    - -
    -

    Summary

    -

    - Summary of your company{`'`}s captable -

    - - -
    - + } + title="Work in progress." + subtitle="This page is not yet available." + > + + ); }; -export default OverviewPage; +export default CaptablePage; From 194c45373aff6229c293fd7656a7ebed095c9b9b Mon Sep 17 00:00:00 2001 From: Puru D Date: Mon, 20 May 2024 01:57:54 -0500 Subject: [PATCH 14/14] feat: switch to captable/captable:latest --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 07c5b15d2..82e89b249 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -58,6 +58,6 @@ jobs: version: latest - name: 🚀 Deploy Production - run: flyctl deploy --remote-only --image captable/captable:debug + run: flyctl deploy --remote-only --image captable/captable:latest env: FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}