Skip to content

Instantly share code, notes, and snippets.

@wilyJ80
Created February 28, 2025 13:18
Show Gist options
  • Save wilyJ80/a478f202ab3334d30115d5b040c6a2e3 to your computer and use it in GitHub Desktop.
Save wilyJ80/a478f202ab3334d30115d5b040c6a2e3 to your computer and use it in GitHub Desktop.
connect-pg-simple cookie table in node-pg-migrate syntax
exports.shorthands = undefined;
exports.up = (pgm) => {
pgm.createTable("session", {
sid: { type: "varchar", notNull: true, primaryKey: true },
sess: { type: "json", notNull: true },
expire: { type: "timestamp(6)", notNull: true },
});
pgm.createIndex("session", "expire", { name: "IDX_session_expire" });
};
exports.down = (pgm) => {
pgm.dropIndex("session", "expire", { ifExists: true });
pgm.dropTable("session", { ifExists: true });
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment