{"size": 1580, "ext": "js", "max_stars_repo_path": "apps/application-system/api/migrations/20210603151733-payment.js", "max_stars_repo_name": "Sendiradid/island.is", "max_stars_repo_stars_event_min_datetime": "2020-09-05T21:44:32.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-29T09:40:53.000Z", "max_issues_repo_path": "apps/application-system/api/migrations/20210603151733-payment.js", "max_issues_repo_name": "Sendiradid/island.is", "max_issues_repo_issues_event_min_datetime": "2020-09-01T08:55:21.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T23:31:50.000Z", "max_forks_repo_path": "apps/application-system/api/migrations/20210603151733-payment.js", "max_forks_repo_name": "Sendiradid/island.is", "max_forks_repo_forks_event_min_datetime": "2020-09-14T09:59:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-26T18:29:56.000Z"}
{"max_stars_count": 154, "max_issues_count": 3029, "max_forks_count": 32, "avg_line_length": 24.3076923077, "max_line_length": 73, "alphanum_fraction": 0.4981012658}
'use strict'

module.exports = {
  up: (queryInterface, Sequelize) => {
    return queryInterface
      .createTable('payment', {
        id: {
          type: Sequelize.UUID,
          primaryKey: true,
          allowNull: false,
          defaultValue: Sequelize.UUIDV4,
        },
        application_id: {
          type: Sequelize.UUID,
          allowNull: false,
          references: {
            model: 'application',
            key: 'id',
          },
        },
        fulfilled: {
          type: Sequelize.BOOLEAN,
          allowNull: false,
          defaultValue: false,
        },
        reference_id: {
          type: Sequelize.UUID,
          allowNull: true,
        },
        user4: {
          type: Sequelize.STRING,
          allowNull: true,
        },
        definition: {
          type: Sequelize.STRING,
        },
        amount: {
          type: Sequelize.STRING,
          allowNull: false,
        },
        /// maybe remove.
        expires_at: {
          type: Sequelize.DATE,
          allowNull: false,
        },

        created: {
          type: 'TIMESTAMP WITH TIME ZONE',
          defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
          allowNull: false,
        },
        modified: {
          type: 'TIMESTAMP WITH TIME ZONE',
          defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
          allowNull: false,
        },
      })
      .then(() => queryInterface.addIndex('payment', ['application_id']))
  },

  down: (queryInterface, Sequelize) => {
    return queryInterface.dropTable('payment')
  },
}
