Artifact Content
Not logged in

Artifact d45a9fa2fb826c5759d2c6b1ab70953ee1976b06:


module.exports = {
  up: sequelize => {
    return sequelize.query('CREATE TABLE IF NOT EXISTS "Users" ("id"  SERIAL , "username" VARCHAR(255) UNIQUE, "account" VARCHAR(255) UNIQUE, "email" VARCHAR(255) UNIQUE, "email_verified" BOOLEAN, "github_id" INTEGER UNIQUE, "profile_picture" VARCHAR(255), "name" VARCHAR(255), "phone" VARCHAR(255), "address1" VARCHAR(255), "address2" VARCHAR(255), "city" VARCHAR(255), "region" VARCHAR(255), "country" VARCHAR(255), "zip_code" VARCHAR(255), "created_at" TIMESTAMP WITH TIME ZONE NOT NULL, "updated_at" TIMESTAMP WITH TIME ZONE NOT NULL, UNIQUE ("username"), UNIQUE ("account"), UNIQUE ("email"), UNIQUE ("github_id"), PRIMARY KEY ("id"))')
      .then(() => sequelize.query('CREATE TYPE "public"."enum_Payments_state" AS ENUM(\'pending\', \'success\', \'fail\')'))
      .then(() => sequelize.query('CREATE TABLE IF NOT EXISTS "Payments" ("id" UUID , "source_user" INTEGER REFERENCES "Users" ("id") ON DELETE NO ACTION ON UPDATE CASCADE, "source_account" VARCHAR(1024), "source_amount" FLOAT, "source_name" VARCHAR(255), "source_image_url" VARCHAR(255), "destination_user" INTEGER REFERENCES "Users" ("id") ON DELETE NO ACTION ON UPDATE CASCADE, "destination_account" VARCHAR(1024), "destination_amount" FLOAT, "destination_name" VARCHAR(255), "destination_image_url" VARCHAR(255), "transfer" VARCHAR(512) UNIQUE, "state" "public"."enum_Payments_state", "message" VARCHAR(1024), "execution_condition" VARCHAR(1024), "created_at" TIMESTAMP WITH TIME ZONE, "completed_at" TIMESTAMP WITH TIME ZONE, "updated_at" TIMESTAMP WITH TIME ZONE NOT NULL, UNIQUE ("transfer"), PRIMARY KEY ("id"))'))
      .then(() => sequelize.query('CREATE INDEX "Payments_execution_condition_idx" ON "Payments" USING BTREE ("execution_condition")'))
      .then(() => sequelize.query('CREATE TABLE IF NOT EXISTS "Invites" ("code" UUID , "amount" INTEGER, "claimed" BOOLEAN NOT NULL DEFAULT false, "created_at" TIMESTAMP WITH TIME ZONE NOT NULL, "updated_at" TIMESTAMP WITH TIME ZONE NOT NULL, "user_id" INTEGER REFERENCES "Users" ("id") ON DELETE SET NULL ON UPDATE CASCADE, PRIMARY KEY ("code"))'))
      .then(() => sequelize.query('INSERT INTO "Users" ("username","account","updated_at","created_at") VALUES (\'admin\',\'http://wallet1.com/ledger/accounts/admin\',\'2016-11-29 18:21:46.970 +00:00\',\'2016-11-29 18:21:46.970 +00:00\') RETURNING *'))
  }
}