Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
247 views
in Technique[技术] by (71.8m points)

postgresql - How can i make pgAdmin time same as on my local machine

I am using postgresql. When i run some migrations with knexjs - sql builder to make tables in my DB, then the created_at time at the tables is one hour earlier then my time on my local machine.

If the time on my local machine is 13:30, in the tables i get 12:30 when i create timestamps.

exports.up = async function (knex) {
    await knex.schema.createTable("users", function (t) {
        t.uuid('id').primary();
        t.timestamps(true, true);
    });
};

My knexfile.js looks like this

const config = {
  client: 'pg',
  connection: {
    host:     process.env.POSTGRES_HOST || 'localhost',
    database: process.env.POSTGRES_DB || 'db',
    user:     process.env.POSTGRES_USER || 'postgres',
    password: process.env.POSTGRES_PASSWORD || 'pass',
  },
  pool: { min: 0, max: 10 },
  migrations: { directory: './db/migrations' }
};
module.exports = config;

i tried adding

    timezone: 'UTC',

in the connection property but without success.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...