Skip to content

Commit

Permalink
Add global table and insert default values in migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeknovy committed Sep 18, 2024
1 parent 80e50e0 commit 09c97bc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
11 changes: 11 additions & 0 deletions migrations/1725550538880_global.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* eslint-disable camelcase */
const { PgLiteral } = require("node-pg-migrate")
exports.up = pgm => {
pgm.createTable({ schema: "jtl", name: "global" }, {
instance: {
type: "uuid",
"default": new PgLiteral("uuid_generate_v4()"),
notNull: true,
},
})
}
7 changes: 7 additions & 0 deletions migrations/1725551629571_instance-id.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

exports.up = async pgm => {
await pgm.db.query({
text: `INSERT INTO jtl.global DEFAULT VALUES;`,
values: [],
})
}

0 comments on commit 09c97bc

Please sign in to comment.