Commit 541ef9f4 authored by Alessandro CERIONI's avatar Alessandro CERIONI
Browse files

Resetting migrations, as those including the call to the uuid_generate_v4()...

Resetting migrations, as those including the call to the uuid_generate_v4() function wouldn't work on PostgreSQL ditributions lacking the uuid-ossp extention
parent e8173f21
import {MigrationInterface, QueryRunner} from 'typeorm';
export class AddESMd51546865861884 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<any> {
await queryRunner.query(`ALTER TABLE "organization" ADD "elasticSearchMd5" character varying(100)`);
}
public async down(queryRunner: QueryRunner): Promise<any> {
await queryRunner.query(`ALTER TABLE "organization" DROP COLUMN "elasticSearchMd5"`);
}
}
import {MigrationInterface, QueryRunner} from 'typeorm';
export class ChangeProperyESName1546940251175 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<any> {
await queryRunner.query(`ALTER TABLE "organization" RENAME COLUMN "elasticSearchMd5" TO "elasticSearchName"`);
}
public async down(queryRunner: QueryRunner): Promise<any> {
await queryRunner.query(`ALTER TABLE "organization" RENAME COLUMN "elasticSearchName" TO "elasticSearchMd5"`);
}
}
import {MigrationInterface, QueryRunner} from 'typeorm';
import {MigrationInterface, QueryRunner} from "typeorm";
export class InitSchema1543499326934 implements MigrationInterface {
export class initSchema1563573591949 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<any> {
await queryRunner.query(`CREATE TABLE "organization" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "name" character varying(200)` +
` NOT NULL, "description" text NOT NULL, "logo" text, CONSTRAINT "PK_472c1f99a32def1b0abb219cd67" PRIMARY` +
` KEY ("id"))`);
await queryRunner.query(`CREATE TABLE "link" ("id" SERIAL NOT NULL, "name" character varying(100), "url"` +
` character varying(300) NOT NULL, "organizationId" uuid, CONSTRAINT "PK_26206fb7186da72fbb9eaa3fac9"` +
` PRIMARY KEY ("id"))`);
await queryRunner.query(`ALTER TABLE "link" ADD CONSTRAINT "FK_afeaa57181e374e281c9a647eda" FOREIGN KEY` +
` ("organizationId") REFERENCES "organization"("id") ON DELETE CASCADE`);
await queryRunner.query(`CREATE TABLE "organization" ("id" text NOT NULL, "name" character varying(200) NOT NULL, "elasticSearchName" character varying(100), "description" text NOT NULL, "logo" text, CONSTRAINT "PK_472c1f99a32def1b0abb219cd67" PRIMARY KEY ("id"))`);
await queryRunner.query(`CREATE TABLE "link" ("id" text NOT NULL, "name" character varying(100), "url" character varying(300) NOT NULL, "organizationId" text, CONSTRAINT "PK_26206fb7186da72fbb9eaa3fac9" PRIMARY KEY ("id"))`);
await queryRunner.query(`ALTER TABLE "link" ADD CONSTRAINT "FK_afeaa57181e374e281c9a647eda" FOREIGN KEY ("organizationId") REFERENCES "organization"("id") ON DELETE CASCADE`);
}
public async down(queryRunner: QueryRunner): Promise<any> {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment