'Why aren't knex migration not showing in psql database?
I created knexfile.js
module.exports = {
development: {
client: 'pg',
connection: {
filename: 'postgres://localhost/myDB'
}
},
};
Then I create migration
npx knex migrate:make items
And have this data
exports.up = function (knex) {
return knex.schema.createTable("items", (table) => {
table.increments("id").primary();
table.string("title").notNullable();
table.string("description");
table.decimal("price").notNullable();
table.decimal("quantity").unsigned().notNullable();
table.string("image");
});
};
exports.down = function (knex) {
return knex.schema.dropTableIfExists("items");
};
Then I run npx knex migrate:latest
And it indicates that one was migrated
Then I go into psql myDB, run \dt and nothing comes up!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
