/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @typescript-eslint/no-empty-function */
import type { MigrationInterface, QueryRunner } from 'typeorm';

export class AddRentalOrderPeriod1691657890280 implements MigrationInterface {
  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(`
      create table rental_order_period (
        id integer generated by default as identity,
        order_id integer not null,
        start_date timestamp without time zone not null,
        end_date timestamp without time zone not null,
        primary key (id),
        foreign key (order_id) references rental_order(id) on delete cascade
      );

      alter table rental_order
        drop column start_date,
        drop column end_date;
    `);
  }

  public async down(_queryRunner: QueryRunner): Promise<void> {}
}
