mirror of https://github.com/boxyhq/jackson.git
Compare commits
11 Commits
027e340b5c
...
46a6ba4f54
Author | SHA1 | Date |
---|---|---|
Aswin V | 46a6ba4f54 | |
Deepak Prabhakara | 5e21208b77 | |
Deepak Prabhakara | b543987832 | |
Aswin V | 7610ce7e9b | |
Aswin V | 9b0510a885 | |
Aswin V | cb5e443356 | |
Aswin V | f9b21a56c4 | |
Aswin V | e846774bea | |
Aswin V | 8ac30e6be7 | |
Aswin V | 51f0b43084 | |
Aswin V | 2f8ae15eb5 |
|
@ -0,0 +1,14 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class MdNamespace1714417013715 implements MigrationInterface {
|
||||
name = 'MdNamespace1714417013715'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`jackson_store\` MODIFY \`namespace\` varchar(256) NULL`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`jackson_store\` MODIFY \`namespace\` varchar(64) NULL`);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class MssNamespace1714421718208 implements MigrationInterface {
|
||||
name = 'MssNamespace1714421718208'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "jackson_store" ALTER COLUMN "namespace" varchar(256)`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "jackson_store" ALTER COLUMN "namespace" varchar(64)`);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class MsNamespace1714419315556 implements MigrationInterface {
|
||||
name = 'MsNamespace1714419315556'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`jackson_store\` MODIFY \`namespace\` varchar(256) NULL`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`jackson_store\` MODIFY \`namespace\` varchar(64) NULL`);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class MsNamespace1714457285484 implements MigrationInterface {
|
||||
name = 'MsNamespace1714457285484'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`jackson_store\` MODIFY \`namespace\` varchar(256) NULL`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`jackson_store\` MODIFY \`namespace\` varchar(64) NULL`);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class PgNamespace1714452929542 implements MigrationInterface {
|
||||
name = 'PgNamespace1714452929542'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "jackson_store" ALTER COLUMN "namespace" TYPE VARCHAR(256)`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "jackson_store" ALTER COLUMN "namespace" TYPE VARCHAR(64)`);
|
||||
}
|
||||
|
||||
}
|
|
@ -46,7 +46,7 @@ export class JacksonStore {
|
|||
@Index('_jackson_store_namespace')
|
||||
@Column({
|
||||
type: 'varchar',
|
||||
length: 64,
|
||||
length: 256,
|
||||
nullable: true,
|
||||
})
|
||||
namespace?: string;
|
||||
|
|
|
@ -44,7 +44,7 @@ export class JacksonStore {
|
|||
@Index('_jackson_store_namespace')
|
||||
@Column({
|
||||
type: 'varchar',
|
||||
length: 64,
|
||||
length: 256,
|
||||
nullable: true,
|
||||
})
|
||||
namespace?: string;
|
||||
|
|
|
@ -46,7 +46,7 @@ export class JacksonStore {
|
|||
@Index('_jackson_store_namespace')
|
||||
@Column({
|
||||
type: 'varchar',
|
||||
length: 64,
|
||||
length: 256,
|
||||
nullable: true,
|
||||
})
|
||||
namespace?: string;
|
||||
|
|
|
@ -44,7 +44,7 @@ export class JacksonStore {
|
|||
@Index('_jackson_store_namespace')
|
||||
@Column({
|
||||
type: 'varchar',
|
||||
length: 64,
|
||||
length: 256,
|
||||
nullable: true,
|
||||
})
|
||||
namespace?: string;
|
||||
|
|
|
@ -131,19 +131,22 @@ class Sql implements DatabaseDriver {
|
|||
}
|
||||
|
||||
async indexNamespace() {
|
||||
const res = await this.storeRepository.find({
|
||||
where: {
|
||||
namespace: IsNull(),
|
||||
},
|
||||
select: ['key'],
|
||||
});
|
||||
const searchTerm = ':';
|
||||
try {
|
||||
const res = await this.storeRepository.find({
|
||||
where: {
|
||||
namespace: IsNull(),
|
||||
},
|
||||
select: ['key'],
|
||||
});
|
||||
const searchTerm = ':';
|
||||
|
||||
for (const r of res) {
|
||||
const key = r.key;
|
||||
const tokens2 = key.split(searchTerm).slice(0, 2);
|
||||
const value = tokens2.join(searchTerm);
|
||||
await this.storeRepository.update({ key }, { namespace: value });
|
||||
for (const r of res) {
|
||||
const key = r.key;
|
||||
const lastIndex = r.key.lastIndexOf(searchTerm);
|
||||
await this.storeRepository.update({ key }, { namespace: r.key.substring(0, lastIndex) });
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Error running indexNamespace:', err);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue