Skip to content

Commit 23b40bf

Browse files
authored
feat: json to sqlite and sequelize (#19)
* feat: json to sqlite and sequelize * feat: add data migation as first migration inside the migration folder * fix: eslint ignore migration file * feat: run migrations at container startup, before the app starts * fix: cursor pr comment resolution
1 parent 0b37760 commit 23b40bf

24 files changed

+2432
-1615
lines changed

Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,14 @@ COPY --from=backend-build /app/backend/dist ./dist
2323
COPY --from=backend-build /app/backend/node_modules ./node_modules
2424
COPY --from=backend-build /app/backend/package.json ./
2525

26+
# Copy Sequelize migration files and config
27+
COPY --from=backend-build /app/backend/.sequelizerc ./
28+
COPY --from=backend-build /app/backend/src/database ./src/database
29+
2630
# Copy frontend build to public folder
2731
COPY --from=frontend-build /app/frontend/dist ./public
2832

29-
# Create data directory for JSON storage (will be mounted as volume in production)
33+
# Create data directory (will be mounted as volume in production)
3034
RUN mkdir -p /app/data && chown -R node:node /app/data
3135

3236
# Set environment variables
@@ -37,4 +41,5 @@ USER node
3741

3842
EXPOSE 8000
3943

40-
CMD ["node", "dist/main.js"]
44+
COPY --chown=node:node entrypoint.sh ./
45+
CMD ["sh", "entrypoint.sh"]

backend/.sequelizerc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const path = require('path');
2+
3+
module.exports = {
4+
config: path.resolve('src', 'database', 'config.cjs'),
5+
'migrations-path': path.resolve('src', 'database', 'migrations'),
6+
};

backend/eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import tseslint from 'typescript-eslint';
66

77
export default tseslint.config(
88
{
9-
ignores: ['eslint.config.mjs'],
9+
ignores: ['eslint.config.mjs', 'src/database/**/*.js', 'src/database/**/*.cjs'],
1010
},
1111
eslint.configs.recommended,
1212
...tseslint.configs.recommendedTypeChecked,

0 commit comments

Comments
 (0)