Skip to content

Commit

Permalink
feat/migrations (#1)
Browse files Browse the repository at this point in the history
* added migrations and fixed post install job migration

* removed s

* bumped version package
  • Loading branch information
Courtcircuits authored Dec 10, 2024
1 parent 1cb8f80 commit 4df0708
Show file tree
Hide file tree
Showing 7 changed files with 6,012 additions and 22 deletions.
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3.8'
version: "3.8"

services:
postgres:
Expand All @@ -21,15 +21,15 @@ services:
build:
context: ./healthcheck
ports:
- ${PORT}:${PORT}
- 3333:3333
- 9229:9229
env_file:
- .env
environment:
- DB_HOST=postgres
- DB_PORT=5432
- DB_USER=adonis
- DB_PASSWORD=adonis
- DB_USER=postgres
- DB_PASSWORD=postgres
- DB_DATABASE=adonis_app
volumes:
- ./:/home/node/app
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { BaseSchema } from '@adonisjs/lucid/schema'

export default class extends BaseSchema {
protected tableName = 'users'

async up() {
this.schema.createTable(this.tableName, (table) => {
table.increments('id')
table.string('username').notNullable()
table.string('email').notNullable()

table.timestamp('created_at').notNullable()
table.timestamp('updated_at').nullable()
})
}

async down() {
this.schema.dropTable(this.tableName)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { BaseSchema } from '@adonisjs/lucid/schema'

export default class extends BaseSchema {
protected tableName = 'posts'

async up() {
this.schema.createTable(this.tableName, (table) => {
table.increments('id')
table.integer('user_id').references('id').inTable('users').onDelete('CASCADE').notNullable()
table.string('title').notNullable()

table.timestamp('created_at').notNullable()
table.timestamp('updated_at').nullable()
})
}

async down() {
this.schema.dropTable(this.tableName)
}
}
20 changes: 10 additions & 10 deletions healthcheck/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,28 @@
},
"devDependencies": {
"@adonisjs/assembler": "^7.8.2",
"@adonisjs/eslint-config": "^2.0.0-beta.6",
"@adonisjs/eslint-config": "2.0.0-beta.7",
"@adonisjs/prettier-config": "^1.4.0",
"@adonisjs/tsconfig": "^1.4.0",
"@japa/api-client": "^2.0.3",
"@japa/api-client": "^2.0.4",
"@japa/assert": "^3.0.0",
"@japa/plugin-adonisjs": "^3.0.1",
"@japa/runner": "^3.1.4",
"@swc/core": "1.7.26",
"@types/luxon": "^3.4.2",
"@types/node": "^22.7.5",
"eslint": "^9.12.0",
"@types/node": "^22.10.1",
"eslint": "^9.16.0",
"hot-hook": "^0.3.1",
"pino-pretty": "^11.2.2",
"prettier": "^3.3.3",
"pino-pretty": "^11.3.0",
"prettier": "^3.4.2",
"ts-node-maintained": "^10.9.4",
"typescript": "~5.6"
"typescript": "~5.6.3"
},
"dependencies": {
"@adonisjs/auth": "^9.2.3",
"@adonisjs/core": "^6.14.1",
"@adonisjs/auth": "^9.2.4",
"@adonisjs/core": "^6.16.0",
"@adonisjs/cors": "^2.2.1",
"@adonisjs/lucid": "^21.3.0",
"@adonisjs/lucid": "^21.5.1",
"@vinejs/vine": "^2.1.0",
"luxon": "^3.5.0",
"pg": "^8.13.1",
Expand Down
Loading

0 comments on commit 4df0708

Please sign in to comment.