migrations, dev db
This commit is contained in:
parent
f49b7fad08
commit
bd50b21281
5 changed files with 46 additions and 17 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -22,3 +22,5 @@ dist-ssr
|
|||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
.env
|
||||
11
docker-compose.yml
Normal file
11
docker-compose.yml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
version: '3.8'
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:17
|
||||
environment:
|
||||
POSTGRES_DB: ${POSTGRES_DB}
|
||||
POSTGRES_USER: ${POSTGRES_USER}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||
ports:
|
||||
- "${POSTGRES_PORT}:${POSTGRES_PORT}"
|
||||
|
|
@ -7,7 +7,8 @@
|
|||
"build": "vite build",
|
||||
"lint": "eslint .",
|
||||
"preview": "vite preview",
|
||||
"dev-backend": "node --watch src/back/main.js"
|
||||
"dev-backend": "node --watch src/back/main.js",
|
||||
"dev-database": "docker compose up -d"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tailwindcss/vite": "^4.1.7",
|
||||
|
|
|
|||
|
|
@ -24,22 +24,6 @@ module.exports = {
|
|||
},
|
||||
{ transaction: t }
|
||||
),
|
||||
queryInterface.bulkInsert(
|
||||
"hello_world",
|
||||
[
|
||||
{
|
||||
first_name: "John",
|
||||
last_name: "Doe",
|
||||
created_at: new Date(),
|
||||
},
|
||||
{
|
||||
first_name: "Jane",
|
||||
last_name: "Smith",
|
||||
created_at: new Date(),
|
||||
},
|
||||
],
|
||||
{ transaction: t }
|
||||
),
|
||||
]);
|
||||
});
|
||||
},
|
||||
31
src/back/database/migrations/02-seed-data.js
Normal file
31
src/back/database/migrations/02-seed-data.js
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
up: (queryInterface, Sequelize) => {
|
||||
return queryInterface.sequelize.transaction((t) => {
|
||||
return Promise.all([
|
||||
queryInterface.bulkInsert(
|
||||
"hello_world",
|
||||
[
|
||||
{
|
||||
first_name: "John",
|
||||
last_name: "Doe",
|
||||
created_at: new Date(),
|
||||
},
|
||||
{
|
||||
first_name: "Jane",
|
||||
last_name: "Smith",
|
||||
created_at: new Date(),
|
||||
},
|
||||
],
|
||||
{ transaction: t }
|
||||
),
|
||||
]);
|
||||
});
|
||||
},
|
||||
down: (queryInterface, Sequelize) => {
|
||||
return queryInterface.bulkDelete(
|
||||
"hello_world"
|
||||
);
|
||||
},
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue