chore(db): migrate from SQLite to PostgreSQL

- Change Prisma provider from sqlite to postgresql
- Replace better-sqlite3 adapter with @prisma/adapter-pg
- Update prisma.config.ts and lib/prisma.ts for PostgreSQL
- Add DATABASE_URL to .env.local
- Regenerate Prisma client for PostgreSQL
- Recreate migrations for PostgreSQL database
This commit is contained in:
jessy-david-dev
2026-04-11 15:50:44 +02:00
parent 5cd32c37e0
commit 875a299cd4
17 changed files with 372 additions and 149 deletions
+189 -28
View File
@@ -11,6 +11,9 @@ importers:
'@panva/hkdf':
specifier: ^1.2.1
version: 1.2.1
'@prisma/adapter-pg':
specifier: ^7.7.0
version: 7.7.0
'@prisma/client':
specifier: ^7.7.0
version: 7.7.0(prisma@7.7.0(@types/react-dom@19.2.3(@types/react@19.2.14))(@types/react@19.2.14)(better-sqlite3@12.8.0)(react-dom@19.2.4(react@19.2.4))(react@19.2.4)(typescript@5.9.3))(typescript@5.9.3)
@@ -26,6 +29,9 @@ importers:
next-auth:
specifier: 5.0.0-beta.30
version: 5.0.0-beta.30(next@16.2.3(@babel/core@7.29.0)(react-dom@19.2.4(react@19.2.4))(react@19.2.4))(react@19.2.4)
pg:
specifier: ^8.20.0
version: 8.20.0
react:
specifier: 19.2.4
version: 19.2.4
@@ -36,9 +42,6 @@ importers:
specifier: ^16.15.0
version: 16.15.0
devDependencies:
'@prisma/adapter-better-sqlite3':
specifier: ^7.7.0
version: 7.7.0
'@tailwindcss/postcss':
specifier: ^4
version: 4.2.2
@@ -57,9 +60,6 @@ importers:
'@types/react-dom':
specifier: ^19
version: 19.2.3(@types/react@19.2.14)
better-sqlite3:
specifier: '12'
version: 12.8.0
eslint:
specifier: ^9
version: 9.39.4(jiti@2.6.1)
@@ -478,8 +478,8 @@ packages:
'@panva/hkdf@1.2.1':
resolution: {integrity: sha512-6oclG6Y3PiDFcoyk8srjLfVKyMfVCKJ27JwNPViuXziFpmdz+MZnZN/aKY0JGXgYuO/VghU0jcOAZgWXZ1Dmrw==}
'@prisma/adapter-better-sqlite3@7.7.0':
resolution: {integrity: sha512-K6V9AHEKBBC/zo5gXb3PO5A0dYv/fSpCRMnbKY9lpB7B+02MdLSVVP6JtMpLD+NcPDQxKvKACJO7n+zZH4hA5g==}
'@prisma/adapter-pg@7.7.0':
resolution: {integrity: sha512-q33Ta8sKbgzEpAy0lx45tAq//yMv0qcb+8nj+TCA3P4wiAY+OBFEFk/NDkZncAfHaNJeGo5WJpJdpbL+ijYx8g==}
'@prisma/client-runtime-utils@7.7.0':
resolution: {integrity: sha512-BLyd0UpFYOtyJFTHm7jS9vesHW7P83abibodQMiIofqjBKzDHQ1VAsQkdfvXyYDkPlONPfOTz7/rv3x/+CQqvQ==}
@@ -734,6 +734,9 @@ packages:
'@types/node@20.19.39':
resolution: {integrity: sha512-orrrD74MBUyK8jOAD/r0+lfa1I2MO6I+vAkmAWzMYbCcgrN4lCrmK52gRFQq/JRxfYPfonkr4b0jcY7Olqdqbw==}
'@types/pg@8.20.0':
resolution: {integrity: sha512-bEPFOaMAHTEP1EzpvHTbmwR8UsFyHSKsRisLIHVMXnpNefSbGA1bD6CVy+qKjGSqmZqNqBDV2azOBo8TgkcVow==}
'@types/react-dom@19.2.3':
resolution: {integrity: sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==}
peerDependencies:
@@ -2054,6 +2057,40 @@ packages:
perfect-debounce@1.0.0:
resolution: {integrity: sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==}
pg-cloudflare@1.3.0:
resolution: {integrity: sha512-6lswVVSztmHiRtD6I8hw4qP/nDm1EJbKMRhf3HCYaqud7frGysPv7FYJ5noZQdhQtN2xJnimfMtvQq21pdbzyQ==}
pg-connection-string@2.12.0:
resolution: {integrity: sha512-U7qg+bpswf3Cs5xLzRqbXbQl85ng0mfSV/J0nnA31MCLgvEaAo7CIhmeyrmJpOr7o+zm0rXK+hNnT5l9RHkCkQ==}
pg-int8@1.0.1:
resolution: {integrity: sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==}
engines: {node: '>=4.0.0'}
pg-pool@3.13.0:
resolution: {integrity: sha512-gB+R+Xud1gLFuRD/QgOIgGOBE2KCQPaPwkzBBGC9oG69pHTkhQeIuejVIk3/cnDyX39av2AxomQiyPT13WKHQA==}
peerDependencies:
pg: '>=8.0'
pg-protocol@1.13.0:
resolution: {integrity: sha512-zzdvXfS6v89r6v7OcFCHfHlyG/wvry1ALxZo4LqgUoy7W9xhBDMaqOuMiF3qEV45VqsN6rdlcehHrfDtlCPc8w==}
pg-types@2.2.0:
resolution: {integrity: sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==}
engines: {node: '>=4'}
pg@8.20.0:
resolution: {integrity: sha512-ldhMxz2r8fl/6QkXnBD3CR9/xg694oT6DZQ2s6c/RI28OjtSOpxnPrUCGOBJ46RCUxcWdx3p6kw/xnDHjKvaRA==}
engines: {node: '>= 16.0.0'}
peerDependencies:
pg-native: '>=3.0.1'
peerDependenciesMeta:
pg-native:
optional: true
pgpass@1.0.5:
resolution: {integrity: sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==}
picocolors@1.1.1:
resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==}
@@ -2080,6 +2117,26 @@ packages:
resolution: {integrity: sha512-7a70Nsot+EMX9fFU3064K/kdHWZqGVY+BADLyXc8Dfv+mTLLVl6JzJpPaCZ2kQL9gIJvKXSLMHhqdRRjwQeFtw==}
engines: {node: ^10 || ^12 || >=14}
postgres-array@2.0.0:
resolution: {integrity: sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==}
engines: {node: '>=4'}
postgres-array@3.0.4:
resolution: {integrity: sha512-nAUSGfSDGOaOAEGwqsRY27GPOea7CNipJPOA7lPbdEpx5Kg3qzdP0AaWC5MlhTWV9s4hFX39nomVZ+C4tnGOJQ==}
engines: {node: '>=12'}
postgres-bytea@1.0.1:
resolution: {integrity: sha512-5+5HqXnsZPE65IJZSMkZtURARZelel2oXUEO8rH83VS/hxH5vv1uHquPg5wZs8yMAfdv971IU+kcPUczi7NVBQ==}
engines: {node: '>=0.10.0'}
postgres-date@1.0.7:
resolution: {integrity: sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==}
engines: {node: '>=0.10.0'}
postgres-interval@1.2.0:
resolution: {integrity: sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==}
engines: {node: '>=0.10.0'}
postgres@3.4.7:
resolution: {integrity: sha512-Jtc2612XINuBjIl/QTWsV5UvE8UHuNblcO3vVADSrKsrc6RqGX6lOW1cEo3CM2v0XG4Nat8nI+YM7/f26VxXLw==}
engines: {node: '>=12'}
@@ -2293,6 +2350,10 @@ packages:
resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==}
engines: {node: '>=0.10.0'}
split2@4.2.0:
resolution: {integrity: sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==}
engines: {node: '>= 10.x'}
sqlstring@2.3.3:
resolution: {integrity: sha512-qC9iz2FlN7DQl3+wjwn3802RTyjCx7sDvfQEXchwa6CWOx07/WVfh91gBmQ9fahw8snwGEWU3xGzOt4tFyHLxg==}
engines: {node: '>= 0.6'}
@@ -2497,6 +2558,10 @@ packages:
wrappy@1.0.2:
resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==}
xtend@4.0.2:
resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==}
engines: {node: '>=0.4'}
yallist@3.1.1:
resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==}
@@ -2886,10 +2951,14 @@ snapshots:
'@panva/hkdf@1.2.1': {}
'@prisma/adapter-better-sqlite3@7.7.0':
'@prisma/adapter-pg@7.7.0':
dependencies:
'@prisma/driver-adapter-utils': 7.7.0
better-sqlite3: 12.8.0
'@types/pg': 8.20.0
pg: 8.20.0
postgres-array: 3.0.4
transitivePeerDependencies:
- pg-native
'@prisma/client-runtime-utils@7.7.0': {}
@@ -3137,6 +3206,12 @@ snapshots:
dependencies:
undici-types: 6.21.0
'@types/pg@8.20.0':
dependencies:
'@types/node': 20.19.39
pg-protocol: 1.13.0
pg-types: 2.2.0
'@types/react-dom@19.2.3(@types/react@19.2.14)':
dependencies:
'@types/react': 19.2.14
@@ -3408,7 +3483,8 @@ snapshots:
balanced-match@4.0.4: {}
base64-js@1.5.1: {}
base64-js@1.5.1:
optional: true
baseline-browser-mapping@2.10.17: {}
@@ -3420,16 +3496,19 @@ snapshots:
dependencies:
bindings: 1.5.0
prebuild-install: 7.1.3
optional: true
bindings@1.5.0:
dependencies:
file-uri-to-path: 1.0.0
optional: true
bl@4.1.0:
dependencies:
buffer: 5.7.1
inherits: 2.0.4
readable-stream: 3.6.2
optional: true
brace-expansion@1.1.13:
dependencies:
@@ -3456,6 +3535,7 @@ snapshots:
dependencies:
base64-js: 1.5.1
ieee754: 1.2.1
optional: true
c12@3.1.0:
dependencies:
@@ -3506,7 +3586,8 @@ snapshots:
dependencies:
readdirp: 4.1.2
chownr@1.1.4: {}
chownr@1.1.4:
optional: true
citty@0.1.6:
dependencies:
@@ -3569,8 +3650,10 @@ snapshots:
decompress-response@6.0.0:
dependencies:
mimic-response: 3.1.0
optional: true
deep-extend@0.6.0: {}
deep-extend@0.6.0:
optional: true
deep-is@0.1.4: {}
@@ -3622,6 +3705,7 @@ snapshots:
end-of-stream@1.4.5:
dependencies:
once: 1.4.0
optional: true
enhanced-resolve@5.20.1:
dependencies:
@@ -3940,7 +4024,8 @@ snapshots:
esutils@2.0.3: {}
expand-template@2.0.3: {}
expand-template@2.0.3:
optional: true
exsolve@1.0.8: {}
@@ -3976,7 +4061,8 @@ snapshots:
dependencies:
flat-cache: 4.0.1
file-uri-to-path@1.0.0: {}
file-uri-to-path@1.0.0:
optional: true
fill-range@7.1.1:
dependencies:
@@ -4003,7 +4089,8 @@ snapshots:
cross-spawn: 7.0.6
signal-exit: 4.1.0
fs-constants@1.0.0: {}
fs-constants@1.0.0:
optional: true
function-bind@1.1.2: {}
@@ -4065,7 +4152,8 @@ snapshots:
nypm: 0.6.5
pathe: 2.0.3
github-from-package@0.0.0: {}
github-from-package@0.0.0:
optional: true
glob-parent@5.1.2:
dependencies:
@@ -4128,7 +4216,8 @@ snapshots:
dependencies:
safer-buffer: 2.1.2
ieee754@1.2.1: {}
ieee754@1.2.1:
optional: true
ignore@5.3.2: {}
@@ -4141,9 +4230,11 @@ snapshots:
imurmurhash@0.1.4: {}
inherits@2.0.4: {}
inherits@2.0.4:
optional: true
ini@1.3.8: {}
ini@1.3.8:
optional: true
internal-slot@1.1.0:
dependencies:
@@ -4406,7 +4497,8 @@ snapshots:
braces: 3.0.3
picomatch: 2.3.2
mimic-response@3.1.0: {}
mimic-response@3.1.0:
optional: true
minimatch@10.2.5:
dependencies:
@@ -4418,7 +4510,8 @@ snapshots:
minimist@1.2.8: {}
mkdirp-classic@0.5.3: {}
mkdirp-classic@0.5.3:
optional: true
ms@2.1.3: {}
@@ -4440,7 +4533,8 @@ snapshots:
nanoid@3.3.11: {}
napi-build-utils@2.0.0: {}
napi-build-utils@2.0.0:
optional: true
napi-postinstall@0.3.4: {}
@@ -4479,6 +4573,7 @@ snapshots:
node-abi@3.89.0:
dependencies:
semver: 7.7.4
optional: true
node-exports-info@1.6.0:
dependencies:
@@ -4546,6 +4641,7 @@ snapshots:
once@1.4.0:
dependencies:
wrappy: 1.0.2
optional: true
optionator@0.9.4:
dependencies:
@@ -4584,6 +4680,41 @@ snapshots:
perfect-debounce@1.0.0: {}
pg-cloudflare@1.3.0:
optional: true
pg-connection-string@2.12.0: {}
pg-int8@1.0.1: {}
pg-pool@3.13.0(pg@8.20.0):
dependencies:
pg: 8.20.0
pg-protocol@1.13.0: {}
pg-types@2.2.0:
dependencies:
pg-int8: 1.0.1
postgres-array: 2.0.0
postgres-bytea: 1.0.1
postgres-date: 1.0.7
postgres-interval: 1.2.0
pg@8.20.0:
dependencies:
pg-connection-string: 2.12.0
pg-pool: 3.13.0(pg@8.20.0)
pg-protocol: 1.13.0
pg-types: 2.2.0
pgpass: 1.0.5
optionalDependencies:
pg-cloudflare: 1.3.0
pgpass@1.0.5:
dependencies:
split2: 4.2.0
picocolors@1.1.1: {}
picomatch@2.3.2: {}
@@ -4610,6 +4741,18 @@ snapshots:
picocolors: 1.1.1
source-map-js: 1.2.1
postgres-array@2.0.0: {}
postgres-array@3.0.4: {}
postgres-bytea@1.0.1: {}
postgres-date@1.0.7: {}
postgres-interval@1.2.0:
dependencies:
xtend: 4.0.2
postgres@3.4.7: {}
preact-render-to-string@6.5.11(preact@10.24.3):
@@ -4632,6 +4775,7 @@ snapshots:
simple-get: 4.0.1
tar-fs: 2.1.4
tunnel-agent: 0.6.0
optional: true
prelude-ls@1.2.1: {}
@@ -4669,6 +4813,7 @@ snapshots:
dependencies:
end-of-stream: 1.4.5
once: 1.4.0
optional: true
punycode@2.3.1: {}
@@ -4687,6 +4832,7 @@ snapshots:
ini: 1.3.8
minimist: 1.2.8
strip-json-comments: 2.0.1
optional: true
react-dom@19.2.4(react@19.2.4):
dependencies:
@@ -4702,6 +4848,7 @@ snapshots:
inherits: 2.0.4
string_decoder: 1.3.0
util-deprecate: 1.0.2
optional: true
readdirp@4.1.2: {}
@@ -4758,7 +4905,8 @@ snapshots:
has-symbols: 1.1.0
isarray: 2.0.5
safe-buffer@5.2.1: {}
safe-buffer@5.2.1:
optional: true
safe-push-apply@1.0.0:
dependencies:
@@ -4873,18 +5021,22 @@ snapshots:
signal-exit@4.1.0: {}
simple-concat@1.0.1: {}
simple-concat@1.0.1:
optional: true
simple-get@4.0.1:
dependencies:
decompress-response: 6.0.0
once: 1.4.0
simple-concat: 1.0.1
optional: true
simple-icons@16.15.0: {}
source-map-js@1.2.1: {}
split2@4.2.0: {}
sqlstring@2.3.3: {}
stable-hash@0.0.5: {}
@@ -4949,10 +5101,12 @@ snapshots:
string_decoder@1.3.0:
dependencies:
safe-buffer: 5.2.1
optional: true
strip-bom@3.0.0: {}
strip-json-comments@2.0.1: {}
strip-json-comments@2.0.1:
optional: true
strip-json-comments@3.1.1: {}
@@ -4979,6 +5133,7 @@ snapshots:
mkdirp-classic: 0.5.3
pump: 3.0.4
tar-stream: 2.2.0
optional: true
tar-stream@2.2.0:
dependencies:
@@ -4987,6 +5142,7 @@ snapshots:
fs-constants: 1.0.0
inherits: 2.0.4
readable-stream: 3.6.2
optional: true
tinyexec@1.1.1: {}
@@ -5015,6 +5171,7 @@ snapshots:
tunnel-agent@0.6.0:
dependencies:
safe-buffer: 5.2.1
optional: true
type-check@0.4.0:
dependencies:
@@ -5109,7 +5266,8 @@ snapshots:
dependencies:
punycode: 2.3.1
util-deprecate@1.0.2: {}
util-deprecate@1.0.2:
optional: true
valibot@1.2.0(typescript@5.9.3):
optionalDependencies:
@@ -5162,7 +5320,10 @@ snapshots:
word-wrap@1.2.5: {}
wrappy@1.0.2: {}
wrappy@1.0.2:
optional: true
xtend@4.0.2: {}
yallist@3.1.1: {}