'use strict';

/** @type {import('sequelize-cli').Migration} */
module.exports = {
	async up(queryInterface, Sequelize) {
		await queryInterface.createTable('rides', {
			id: {
				type: Sequelize.INTEGER,
				autoIncrement: true,
				primaryKey: true,
			},
			member_id: {
				type: Sequelize.UUID,
				allowNull: false,
			},
			driver_id: {
				type: Sequelize.UUID,
				allowNull: false,
			},
			bus_id: {
				type: Sequelize.UUID,
				allowNull: false,
			},
			status: {
				type: Sequelize.ENUM('Ongoing', 'Completed', 'Cancelled'),
			},
			start_location: {
				type: Sequelize.STRING,
				allowNull: false,
			},
			end_location: {
				type: Sequelize.STRING,
				allowNull: false,
			},
			createdAt: {
				type: Sequelize.DATE,
				defaultValue: Sequelize.NOW,
			},
			updatedAt: {
				type: Sequelize.DATE,
				defaultValue: Sequelize.NOW,
			},
		});
	},

	async down(queryInterface, Sequelize) {
		await queryInterface.dropTable('rides');
	},
};
