Initial commit

This commit is contained in:
2025-12-07 14:32:46 +00:00
commit 0a0969b8af
4726 changed files with 536089 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
exports.up = async function (knex) {
const exists = await knex.schema.hasTable('charger_schedules');
if (exists) return;
return knex.schema.createTable('charger_schedules', (t) => {
t.uuid('id')
.primary()
.defaultTo(knex.raw('gen_random_uuid()'));
t.uuid('charger_id')
.notNullable()
.references('id')
.inTable('chargers')
.onDelete('CASCADE');
t.string('start', 5).notNullable();
t.string('end', 5).notNullable();
t.enu('repeat', ['everyday', 'weekdays', 'weekends'])
.notNullable()
.defaultTo('everyday');
t.timestamp('created_at').defaultTo(knex.fn.now());
});
};
exports.down = function (knex) {
return knex.schema.dropTableIfExists('charger_schedules');
};