• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript typeorm.QueryRunner类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中typeorm.QueryRunner的典型用法代码示例。如果您正苦于以下问题:TypeScript QueryRunner类的具体用法?TypeScript QueryRunner怎么用?TypeScript QueryRunner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了QueryRunner类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: up

 public async up(queryRunner: QueryRunner): Promise<any> {
     // Remove duplicate foreign key
     await queryRunner.query("ALTER TABLE `datasets` DROP FOREIGN KEY `FK_d717ea97450b05d06316d69501a`")
     // Add missing foreign key constraints
     await queryRunner.query("ALTER TABLE `dataset_files` ADD CONSTRAINT `dataset_files_datasetId` FOREIGN KEY (`datasetId`) REFERENCES `datasets`(`id`)")
     await queryRunner.query("ALTER TABLE `sources` ADD CONSTRAINT `sources_datasetId` FOREIGN KEY (`datasetId`) REFERENCES `datasets`(`id`)")
 }
开发者ID:OurWorldInData,项目名称:owid-grapher,代码行数:7,代码来源:1541082619105-AddForeignKeyConstraints.ts


示例2: up

 public async up(queryRunner: QueryRunner): Promise<any> {
     await queryRunner.query("CREATE TABLE `posts` (`id` int NOT NULL AUTO_INCREMENT, `title` text NOT NULL, `slug` text NOT NULL, `type` text NOT NULL, `status` text NOT NULL, `content` longtext NOT NULL, `published_at` datetime NULL, `updated_at` datetime NOT NULL, PRIMARY KEY(`id`)) ENGINE=InnoDB")
     await queryRunner.query("CREATE TABLE `post_tags` (`post_id` int NOT NULL, `tag_id` int NOT NULL, PRIMARY KEY (`post_id`, `tag_id`)) ENGINE=InnoDB")
     await queryRunner.query("ALTER TABLE `post_tags` ADD CONSTRAINT `FK_post_tags_post_id` FOREIGN KEY (`post_id`) REFERENCES `posts`(`id`) ON DELETE CASCADE")
     await queryRunner.query("ALTER TABLE `post_tags` ADD CONSTRAINT `FK_post_tags_tag_id` FOREIGN KEY (`tag_id`) REFERENCES `tags`(`id`) ON DELETE CASCADE")
     await queryRunner.query("update tags t inner join tags p on p.id=t.parentId and p.isBulkImport=1 set t.isBulkImport=1")
 }
开发者ID:OurWorldInData,项目名称:owid-grapher,代码行数:7,代码来源:1548443699660-OWIDPosts.ts


示例3: up

    public async up(queryRunner: QueryRunner): Promise<any> {
        await queryRunner.query("alter table charts ADD is_indexable BOOLEAN NOT NULL DEFAULT FALSE")

        const chartTags = await queryRunner.query("select ct.chartId, t.parentId from chart_tags ct join tags t on ct.tagId = t.id") as { chartId: number, parentId: number }[]

        for (const ct of chartTags) {
            if (PUBLIC_TAG_PARENT_IDS.includes(ct.parentId)) {
                await queryRunner.query("update charts set is_indexable = ? where id = ?", [true, ct.chartId])
            }
        }
    }
开发者ID:OurWorldInData,项目名称:owid-grapher,代码行数:11,代码来源:1551312762103-ChartsIsIndexable.ts


示例4: up

    public async up(queryRunner: QueryRunner): Promise<any> {
        await queryRunner.query("CREATE TABLE `chart_revisions` (`id` bigint NOT NULL AUTO_INCREMENT, `chartId` int, `userId` int, `config` json, `createdAt` datetime, `updatedAt` datetime, PRIMARY KEY(`id`)) ENGINE=InnoDB")

        // Create one log for each existing chart
        const charts = await queryRunner.query("SELECT id, config, updatedAt, lastEditedByUserId FROM charts")

        let chartRevisions = []
        for (let i = 0; i < charts.length; i++) {
            const chart = charts[i]
            chartRevisions.push([chart.id, chart.lastEditedByUserId, chart.updatedAt, chart.updatedAt, chart.config])

            if (i % 100 === 0 || i === charts.length-1) {
                await queryRunner.query("INSERT INTO chart_revisions (chartId, userId, createdAt, updatedAt, config) VALUES ?", [chartRevisions])
                chartRevisions = []
            }
        }
    }
开发者ID:OurWorldInData,项目名称:owid-grapher,代码行数:17,代码来源:1542908319140-CreateChartLogs.ts


示例5: up

    public async up(queryRunner: QueryRunner): Promise<any> {
        await queryRunner.query("ALTER TABLE variables CHANGE short_unit shortUnit VARCHAR(255)")

        const variables = await queryRunner.query("SELECT * FROM variables v JOIN datasets d ON d.id=v.datasetId")
        for (const v of variables) {
            if (v.unit || v.shortUnit) {
                const display = JSON.parse(v.display)
                if (v.unit && display.unit === undefined)
                    display.unit = v.unit
                if (v.shortUnit && display.shortUnit === undefined)
                    display.shortUnit = v.shortUnit

                if (JSON.stringify(display) !== v.display)
                    await queryRunner.query("UPDATE variables SET display=? WHERE id=?", [JSON.stringify(display), v.id])
            }
        }
    }
开发者ID:OurWorldInData,项目名称:owid-grapher,代码行数:17,代码来源:1536206761921-VariableCleanup.ts


示例6: up

    public async up(queryRunner: QueryRunner): Promise<any> {
        // Split datasets with multiple source infos
        const datasets = await queryRunner.query("select d.* from datasets d join sources s on s.datasetId=d.id where d.namespace='owid' group by d.id having count(s.id) > 1;")

        for (const dataset of datasets) {
            const sources = await queryRunner.query("select * from sources s where s.datasetId=? order by s.id ASC", [dataset.id]) as any[]

            const splitSources = sources.slice(1)

            for (const source of splitSources) {
                const variables = await queryRunner.query("select * from variables v where v.sourceId=?", [source.id])
                if (variables.length) {
                    const row = [`${variables[0].name} (split)`, dataset.namespace, dataset.description, dataset.createdAt, dataset.updatedAt, dataset.dataEditedAt, dataset.dataEditedByUserId, dataset.metadataEditedAt, dataset.metadataEditedByUserId, dataset.createdByUserId, true]
                    const result = await queryRunner.query(`INSERT INTO datasets (name, namespace, description, createdAt, updatedAt, dataEditedAt, dataEditedByUserId, metadataEditedAt, metadataEditedByUserId, createdByUserId, isPrivate) VALUES (?)`, [row])

                    const datasetId = result.insertId

                    await queryRunner.query("update sources set datasetId=? where id=?", [datasetId, source.id])
                    await queryRunner.query("update variables set datasetId=? where sourceId=?", [datasetId, source.id])
                } else {
                    await queryRunner.query("delete from sources where id=?", [source.id])
                }
            }
        }
    }
开发者ID:OurWorldInData,项目名称:owid-grapher,代码行数:25,代码来源:1537515786863-DatasetSourceSplit.ts


示例7: down

 public async down(queryRunner: QueryRunner): Promise<any> {
     await queryRunner.query("ALTER TABLE `discord_d_b_server_users_discord_d_b_user` DROP FOREIGN KEY `fk_94d1e5a3251d105fddd937e8252`");
     await queryRunner.query("ALTER TABLE `discord_d_b_server_users_discord_d_b_user` DROP FOREIGN KEY `fk_6caa8ffc1fd9161d73fba4b5c6c`");
     await queryRunner.query("ALTER TABLE `game_time` DROP FOREIGN KEY `fk_8fb82afc6193a996712201d1146`");
     await queryRunner.query("DROP TABLE `discord_d_b_server_users_discord_d_b_user`");
     await queryRunner.query("DROP TABLE `discord_d_b_server`");
     await queryRunner.query("DROP TABLE `discord_d_b_user`");
     await queryRunner.query("DROP TABLE `game_time`");
 }
开发者ID:Goyatuzo,项目名称:LurkerBot,代码行数:9,代码来源:1523778277076-initalize.ts


示例8: up

 public async up(queryRunner: QueryRunner): Promise<any> {
     await queryRunner.query("CREATE TABLE `game_time` (`id` varchar(255) NOT NULL PRIMARY KEY, `secondsPlayed` int(11) NOT NULL, `discordUserId` char(19)) ENGINE=InnoDB");
     await queryRunner.query("CREATE TABLE `discord_d_b_user` (`id` char(19) NOT NULL, `username` varchar(255) NOT NULL, `discriminator` char(4) NOT NULL, PRIMARY KEY(`id`)) ENGINE=InnoDB");
     await queryRunner.query("CREATE TABLE `discord_d_b_server` (`id` char(19) NOT NULL, `name` varchar(255) NOT NULL, PRIMARY KEY(`id`)) ENGINE=InnoDB");
     await queryRunner.query("CREATE TABLE `discord_d_b_server_users_discord_d_b_user` (`discordDBServerId` char(19) NOT NULL, `discordDBUserId` char(19) NOT NULL, PRIMARY KEY(`discordDBServerId`, `discordDBUserId`)) ENGINE=InnoDB");
     await queryRunner.query("ALTER TABLE `game_time` ADD CONSTRAINT `fk_8fb82afc6193a996712201d1146` FOREIGN KEY (`discordUserId`) REFERENCES `discord_d_b_user`(`id`)");
     await queryRunner.query("ALTER TABLE `discord_d_b_server_users_discord_d_b_user` ADD CONSTRAINT `fk_6caa8ffc1fd9161d73fba4b5c6c` FOREIGN KEY (`discordDBServerId`) REFERENCES `discord_d_b_server`(`id`)");
     await queryRunner.query("ALTER TABLE `discord_d_b_server_users_discord_d_b_user` ADD CONSTRAINT `fk_94d1e5a3251d105fddd937e8252` FOREIGN KEY (`discordDBUserId`) REFERENCES `discord_d_b_user`(`id`)");
 }
开发者ID:Goyatuzo,项目名称:LurkerBot,代码行数:9,代码来源:1523778277076-initalize.ts


示例9: up

    public async up(queryRunner: QueryRunner): Promise<any> {
        await queryRunner.query("UPDATE datasets SET dataEditedByUserId=15 WHERE dataEditedByUserId IS NULL")
        await queryRunner.query("UPDATE datasets SET metadataEditedByUserId=15 WHERE metadataEditedByUserId IS NULL")
        await queryRunner.query("UPDATE datasets SET createdByUserId=dataEditedByUserId")

        await queryRunner.query("ALTER TABLE datasets CHANGE dataEditedByUserId dataEditedByUserId INTEGER NOT NULL")
        await queryRunner.query("ALTER TABLE datasets CHANGE metadataEditedByUserId metadataEditedByUserId INTEGER NOT NULL")
        await queryRunner.query("ALTER TABLE datasets CHANGE createdByUserId createdByUserId INTEGER NOT NULL")

        await queryRunner.query("ALTER TABLE `datasets` ADD CONSTRAINT `datasets_createdByUserId` FOREIGN KEY (`createdByUserId`) REFERENCES `users`(`id`)")
    }
开发者ID:OurWorldInData,项目名称:owid-grapher,代码行数:11,代码来源:1536214773165-DatasetTrackingCleanup.ts


示例10: up

    public async up(queryRunner: QueryRunner): Promise<any> {
        const now = new Date()
        await queryRunner.query("ALTER TABLE tags CHANGE categoryId parentId INTEGER DEFAULT NULL;")
        await queryRunner.query("ALTER TABLE tags ADD isBulkImport BOOLEAN NOT NULL DEFAULT FALSE")
        await queryRunner.query("ALTER TABLE tags DROP FOREIGN KEY `dataset_subcategorie_categoryId_cd02a9e3_fk_dataset_c`;")

        for (const category of await queryRunner.query("SELECT * FROM dataset_categories ORDER BY id ASC")) {
            const result = await queryRunner.query("INSERT INTO tags (name, createdAt, updatedAt, isBulkImport) VALUES (?, ?, ?, ?)", [category.name, now, now, category.fetcher_autocreated])

            await queryRunner.query("UPDATE tags SET parentId=? WHERE parentId=?", [result.insertId, category.id])
        }

        await queryRunner.query("ALTER TABLE tags ADD FOREIGN KEY (parentId) REFERENCES tags(id)")
        await queryRunner.query("DROP TABLE dataset_categories")
    }
开发者ID:OurWorldInData,项目名称:owid-grapher,代码行数:15,代码来源:1537350156783-CategoryParenting.ts


示例11: up

 public async up(queryRunner: QueryRunner): Promise<any> {
     // If a Swaziland entity exists, we want to map it to Eswatini
     // before renaming Eswatini to Swaziland.
     await queryRunner.query(`
         UPDATE data_values
         SET entityId = (SELECT id FROM entities WHERE name = 'Eswatini')
         WHERE entityId = (SELECT id FROM entities WHERE name = 'Swaziland')
     `)
     await queryRunner.query(`
         DELETE FROM entities
         WHERE name = 'Swaziland'
     `)
     await queryRunner.query(`
         UPDATE entities
         SET name = 'Swaziland'
         WHERE name = 'Eswatini'
     `)
     await queryRunner.query(`
         UPDATE country_name_tool_countrydata
         SET owid_name = 'Swaziland'
         WHERE owid_name = 'Eswatini'
     `)
 }
开发者ID:OurWorldInData,项目名称:owid-grapher,代码行数:23,代码来源:1544803202664-RenameEswatiniBackToSwaziland.ts


示例12: up

 public async up(queryRunner: QueryRunner): Promise<any> {
     await queryRunner.query(`
         UPDATE entities
         SET name = 'Eswatini'
         WHERE name = 'Swaziland'
     `)
     await queryRunner.query(`
         UPDATE country_name_tool_countrydata
         SET owid_name = 'Eswatini'
         WHERE owid_name = 'Swaziland'
     `)
     const countrydataIds = await queryRunner.query(`
         SELECT id FROM country_name_tool_countrydata
         WHERE owid_name = 'Eswatini'
         LIMIT 1
     `)
     const eswatiniId = countrydataIds[0].id
     await queryRunner.query(`
         INSERT INTO
             country_name_tool_countryname (country_name, owid_country)
         VALUES
             ('Eswatini', ?)
     `, [eswatiniId])
 }
开发者ID:OurWorldInData,项目名称:owid-grapher,代码行数:24,代码来源:1543239904215-SwazilandEswatiniRename.ts


示例13: up

    public async up(queryRunner: QueryRunner): Promise<any> {
        await queryRunner.query("RENAME TABLE dataset_subcategories TO tags")
        await queryRunner.query("CREATE TABLE `dataset_tags` (`datasetId` int NOT NULL, `tagId` int NOT NULL, PRIMARY KEY (`datasetId`, `tagId`)) ENGINE=InnoDB")
        await queryRunner.query("ALTER TABLE `dataset_tags` ADD CONSTRAINT `FK_fa434de5c36953f4efce6b073b3` FOREIGN KEY (`datasetId`) REFERENCES `datasets`(`id`) ON DELETE CASCADE")
        await queryRunner.query("ALTER TABLE `dataset_tags` ADD CONSTRAINT `FK_2e330c9e1074b457d1d238b2dac` FOREIGN KEY (`tagId`) REFERENCES `tags`(`id`) ON DELETE CASCADE")

        for (const dataset of await queryRunner.query("SELECT id, subcategoryId FROM datasets")) {
            await queryRunner.query("INSERT INTO dataset_tags (datasetId, tagId) VALUES (?, ?)", [dataset.id, dataset.subcategoryId])
        }
    }
开发者ID:OurWorldInData,项目名称:owid-grapher,代码行数:10,代码来源:1535683674417-Tags.ts


示例14: up

    public async up(queryRunner: QueryRunner): Promise<any> {
       // await queryRunner.query(`ALTER TABLE "node" RENAME COLUMN "name" TO "title"`);
        await queryRunner.query(`DROP FUNCTION IF EXISTS trigger_change_count_child_after_ins() CASCADE;`);
        await queryRunner.query(`DROP FUNCTION IF EXISTS trigger_change_count_child_after_del() CASCADE;`);

        await queryRunner.query(`CREATE FUNCTION trigger_change_count_child_after_ins()
        RETURNS trigger AS
        $BODY$
        DECLARE
            tmp node%ROWTYPE;
        BEGIN
          SELECT * INTO tmp FROM node WHERE id = NEW.node_id;
        
          tmp.count_child = tmp.count_child + 1;
          
          UPDATE node
          SET count_child = tmp.count_child
          WHERE id = NEW.node_id; 
          
          return NEW;
        END;
        $BODY$
          LANGUAGE plpgsql;`);
        await queryRunner.query(`CREATE TRIGGER change_count_child_after_ins
        AFTER INSERT ON node FOR EACH ROW  
        EXECUTE PROCEDURE trigger_change_count_child_after_ins();`);
        await queryRunner.query(`CREATE FUNCTION trigger_change_count_child_after_del()
        RETURNS trigger AS
        $BODY$
        DECLARE
            tmp node%ROWTYPE;
        BEGIN
          SELECT * INTO tmp FROM node WHERE id = OLD.node_id;
        
          tmp.count_child = tmp.count_child - 1;
          
          UPDATE node
          SET count_child = tmp.count_child
          WHERE id = OLD.node_id; 
        
          return OLD;
        END;
        $BODY$
          LANGUAGE plpgsql;`);
        await queryRunner.query(`CREATE TRIGGER change_count_child_after_del
        AFTER DELETE ON node FOR EACH ROW  
        EXECUTE PROCEDURE trigger_change_count_child_after_del();`);
    }
开发者ID:KrepyshevaVika,项目名称:typeORM,代码行数:48,代码来源:1538477961451-my.ts


示例15: up

 public async up(queryRunner: QueryRunner): Promise<any> {
     await queryRunner.query("CREATE INDEX `chartId` ON chart_revisions(chartId)")
 }
开发者ID:OurWorldInData,项目名称:owid-grapher,代码行数:3,代码来源:1543002209183-AddIndexToChartLogs.ts


示例16: up

 public async up(queryRunner: QueryRunner): Promise<any> {
     await queryRunner.query("ALTER TABLE tags ADD COLUMN specialType VARCHAR(255) DEFAULT NULL")
     await queryRunner.query("UPDATE tags SET name='System', specialType='systemParent' WHERE name='Uncategorized' AND parentId IS NULL")
     await queryRunner.query("UPDATE tags SET specialType='uncategorized' WHERE name='Uncategorized'")
     await queryRunner.query("UPDATE tags SET isBulkImport=1 WHERE name='World Development Indicators'")
 }
开发者ID:OurWorldInData,项目名称:owid-grapher,代码行数:6,代码来源:1537443639977-CategorySpecial.ts


示例17: up

  public async up(queryRunner: QueryRunner): Promise<any> {
    await queryRunner.query(
        `CREATE TABLE "group" (
  id serial PRIMARY KEY,
  name VARCHAR,
  description VARCHAR,
  "createdAt" timestamp with time zone,
  "updatedAt" timestamp with time zone
)`
    );

    await queryRunner.query(
        `CREATE TABLE user_group (
  id serial PRIMARY KEY,
  group_id integer NOT NULL REFERENCES "group"(id),
  user_id integer NOT NULL REFERENCES "user"(id),
  "createdAt" timestamp with time zone,
  "updatedAt" timestamp with time zone,
  UNIQUE (group_id, user_id)
)`
    );
    await queryRunner.query(
        `CREATE TABLE machine (
  id serial PRIMARY KEY,
  group_id integer NOT NULL REFERENCES "group"(id),
  api_key TEXT UNIQUE,
  secret_key TEXT,
  name TEXT,
  description TEXT,
  is_uploading_files BOOLEAN DEFAULT false NOT NULL, -- hack so we can allow only one file upload for a machine at a time
  "createdAt" timestamp with time zone,
  "updatedAt" timestamp with time zone
)`
    );
    await queryRunner.query(
        `INSERT INTO "group" (name, description, "createdAt", "updatedAt") VALUES ('Default Group', 'Default group from migration', NOW(), NOW());`
    );
    await queryRunner.query(
        `INSERT INTO machine (group_id, name, description, "createdAt", "updatedAt") VALUES (1, 'Default Machine', 'Default machine from migration', NOW(), NOW());`
    );
    await queryRunner.query(
        `INSERT INTO user_group (group_id, user_id, "createdAt", "updatedAt") SELECT 1, id, NOW(), NOW() FROM "user";`
    );
    await queryRunner.query(
        `ALTER TABLE alias ADD COLUMN user_group_id integer ;`
    );
    await queryRunner.query(
        `UPDATE alias AS a
SET user_group_id = ug.id
FROM user_group ug
    WHERE a.user_id = ug.user_id
    AND ug.group_id = 1;`
    );
    await queryRunner.query(
        `ALTER TABLE alias ALTER COLUMN user_group_id SET NOT NULL;
ALTER TABLE alias ADD CONSTRAINT alias_user_group_id_fkey  foreign key (user_group_id) REFERENCES "user_group"(id);
ALTER TABLE alias DROP COLUMN user_id;`
    );
    await queryRunner.query(
        `ALTER TABLE "user" ADD COLUMN is_admin boolean DEFAULT false NOT NULL;`
    );
    await queryRunner.query(
        `ALTER TABLE "user" ADD COLUMN invite_code text DEFAULT NULL;`
    );
    await queryRunner.query(
        `CREATE UNIQUE INDEX unique_lower_username_idx ON "user" (LOWER(username));`
    );
    await queryRunner.query(
        `ALTER TABLE score ADD COLUMN machine_id integer REFERENCES machine(id);`
    );
    await queryRunner.query(
        `UPDATE score SET machine_id = 1;`
    );
    await queryRunner.query(
        `ALTER TABLE score ALTER COLUMN machine_id SET NOT NULL;`
    );
    await queryRunner.query(
        `ALTER TABLE rawscore ADD COLUMN machine_id integer REFERENCES machine(id);`
    );
    await queryRunner.query(
        `UPDATE rawscore SET machine_id = 1;`
    );
    await queryRunner.query(
        `ALTER TABLE rawscore ALTER COLUMN machine_id SET NOT NULL;`
    );
    await queryRunner.query(
      `TRUNCATE gameplayed`
    );
    await queryRunner.query(
        `ALTER TABLE gameplayed ADD COLUMN play_count integer NOT NULL DEFAULT 0;`
    );
    await queryRunner.query(
        `ALTER TABLE gameplayed ADD COLUMN machine_id integer NOT NULL REFERENCES machine(id);`
    );
    await queryRunner.query(
        `ALTER TABLE gameplayed ADD CONSTRAINT unique_game_id_machine_id UNIQUE (game_id, machine_id);`
    );
    await queryRunner.query(
        `INSERT INTO gameplayed (game_id, date_time, play_count, "createdAt", "updatedAt", machine_id)
SELECT id, last_played, play_count, now(), now(), 1 from game where last_played is not null;`
//.........这里部分代码省略.........
开发者ID:InsaneWookie,项目名称:mame-highscores,代码行数:101,代码来源:1551135685598-groups.ts


示例18: up

 public async up(queryRunner: QueryRunner): Promise<any> {
     queryRunner.query("ALTER TABLE sources DROP INDEX `sources_name_datasetId_73238c38_uniq`")
 }
开发者ID:OurWorldInData,项目名称:owid-grapher,代码行数:3,代码来源:1538058794819-SourceNonUnique.ts


示例19: up

  public async up(queryRunner: QueryRunner): Promise<any> {

    await queryRunner.query(
        `CREATE TABLE "user" (
                id serial PRIMARY KEY,
                username text,
                password text,
                email text,
                "createdAt" timestamp with time zone,
                "updatedAt" timestamp with time zone
            )`);
    await queryRunner.query(`CREATE TABLE alias (
    id serial PRIMARY KEY,
    user_id integer NOT NULL REFERENCES "user" (id),
    name text,
    "createdAt" timestamp with time zone,
    "updatedAt" timestamp with time zone
)`);
    await queryRunner.query(`CREATE TABLE game (
    id serial PRIMARY KEY,
    name text NOT NULL UNIQUE,
    full_name text,
    has_mapping boolean DEFAULT FALSE,
    decoded_on timestamp with time zone,
    play_count integer NOT NULL DEFAULT 0,
    clone_of integer REFERENCES game (id),
    clone_of_name text,
    last_played timestamp with time zone,
    letter text,
    "order" text,
    sort text,
    year text,
    "createdAt" timestamp with time zone,
    "updatedAt" timestamp with time zone
)`);
    await queryRunner.query(`CREATE TABLE rawscore (
    id serial PRIMARY KEY,
    game_id integer NOT NULL REFERENCES game (id),
    file_type text,
    bytes text,
    "createdAt" timestamp with time zone,
    "updatedAt" timestamp with time zone
)`);
    await queryRunner.query(`CREATE TABLE score (
    id serial PRIMARY KEY,
    game_id integer NOT NULL REFERENCES game (id),
    alias_id integer REFERENCES "alias" (id),
    name text,
    score text,
    rank integer,
    "createdAt" timestamp with time zone,
    "updatedAt" timestamp with time zone
)`);
    await queryRunner.query(`CREATE TABLE mapping (
    id serial PRIMARY KEY,
    game_id integer NOT NULL REFERENCES game (id),
    decoding json,
    "createdAt" timestamp with time zone,
    "updatedAt" timestamp with time zone
)`);
    await queryRunner.query(`CREATE TABLE gameplayed (
  id serial PRIMARY KEY,
  game_id integer NOT NULL REFERENCES game (id),
  date_time timestamp with time zone NOT NULL DEFAULT NOW(),
  "createdAt" timestamp with time zone,
  "updatedAt" timestamp with time zone
)`);
  }
开发者ID:InsaneWookie,项目名称:mame-highscores,代码行数:68,代码来源:1551135240777-base-schema.ts


示例20: up

 public async up(queryRunner: QueryRunner): Promise<any> {
     queryRunner.query("DELETE FROM dataset_tags WHERE tagId=375")
     queryRunner.query("DELETE FROM chart_tags WHERE tagId=375")
 }
开发者ID:OurWorldInData,项目名称:owid-grapher,代码行数:4,代码来源:1545224546433-RemoveUncategorizedTags.ts



注:本文中的typeorm.QueryRunner类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript typeorm.Repository类代码示例发布时间:2022-05-25
下一篇:
TypeScript typeorm.Connection类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap