From 39900b7a9289b6fc8cf6ab2bd92e3fd922f8865e Mon Sep 17 00:00:00 2001 From: Amir Omidi Date: Mon, 10 Aug 2020 17:31:50 -0700 Subject: [PATCH] SQL Migration Extension Skeleton (#11625) * Start on skeleton * Finish up skeleton * . * Change up the skeleton a bit, add some states. --- build/lib/extensions.js | 3 +- build/lib/extensions.ts | 3 +- extensions/sql-migration/images/extension.png | Bin 0 -> 3338 bytes extensions/sql-migration/package.json | 41 ++++++++++++++++++ extensions/sql-migration/package.nls.json | 4 ++ extensions/sql-migration/src/main.ts | 39 +++++++++++++++++ .../sql-migration/src/models/stateMachine.ts | 22 ++++++++++ extensions/sql-migration/src/typings/ref.d.ts | 9 ++++ .../src/wizard/wizardController.ts | 14 ++++++ extensions/sql-migration/tsconfig.json | 20 +++++++++ extensions/sql-migration/yarn.lock | 8 ++++ 11 files changed, 161 insertions(+), 2 deletions(-) create mode 100644 extensions/sql-migration/images/extension.png create mode 100644 extensions/sql-migration/package.json create mode 100644 extensions/sql-migration/package.nls.json create mode 100644 extensions/sql-migration/src/main.ts create mode 100644 extensions/sql-migration/src/models/stateMachine.ts create mode 100644 extensions/sql-migration/src/typings/ref.d.ts create mode 100644 extensions/sql-migration/src/wizard/wizardController.ts create mode 100644 extensions/sql-migration/tsconfig.json create mode 100644 extensions/sql-migration/yarn.lock diff --git a/build/lib/extensions.js b/build/lib/extensions.js index 22423ab4b7..fb143c6a84 100644 --- a/build/lib/extensions.js +++ b/build/lib/extensions.js @@ -222,7 +222,8 @@ const externalExtensions = [ 'sql-database-projects', 'machine-learning', 'sql-assessment', - 'asde-deployment' + 'asde-deployment', + 'sql-migration' ]; // extensions that require a rebuild since they have native parts const rebuildExtensions = [ diff --git a/build/lib/extensions.ts b/build/lib/extensions.ts index e338b0b10e..bcda51df74 100644 --- a/build/lib/extensions.ts +++ b/build/lib/extensions.ts @@ -256,7 +256,8 @@ const externalExtensions = [ 'sql-database-projects', 'machine-learning', 'sql-assessment', - 'asde-deployment' + 'asde-deployment', + 'sql-migration' ]; // extensions that require a rebuild since they have native parts diff --git a/extensions/sql-migration/images/extension.png b/extensions/sql-migration/images/extension.png new file mode 100644 index 0000000000000000000000000000000000000000..c86d6d1e009f12f1ccb246db45303707052175e1 GIT binary patch literal 3338 zcmai%cQhRSvcSK)7OO>HqC`oEUQ$F^K_WpybkV}Hf~=?^HqmwwZV*IIh~7o7(N`Cu zMz^e|8Vs~tv;Y7GElqWUzr_7xaH_w) z{iaRdUr^cJ*H8y%|7dzsUMv9gEn4boM%d|%WI9j7U%cICnsg7=JTU`uUW-Z8%C{dX zUx-@MUQ5}lR+!{O?``K#Cxm5W+@nlXy7*1T~TFVEw=Xd3>7L7WeKdOIhYC8FY?v7Nx zrk9UZV>(^&RNT|A7NIU=q_i@bSDk5$@?Af?ZN!725(_?3kKe(2d3g~-DE*n^1E*hO z2+;kb^wx(({+rxwWfax)DrW@yO5#2C{h{stQ(0j*DKWqFNm6$`&i&d_OIoJ=-hCQl z@=W+Cldz-E=hoQOwL51I`1M|XwK%Sj%?*!a{iuZvDQ&f@dLd5uFyJC1e@4f(0ON5> z4cusZLarU6*rIblNs1YNd&M4UWh$KV>e7O^rdwTy%H9_FYzIv)KfZBX+sH77a2@66 z;W*kBWGYSyT1g6T=C5adQI>k9;);_T{c{JnI&b+DzRSM@?-J%w zh-+IzaT6TzFA7)1!*OQMcb#|`3C>407vm-4x|7ufVU&vQrchdU;yxBjekw3mqdqthMUE z_v_5-9{p(dmr*SAx}4rV5Syj=EV0n4jfaOolaFmz4zmXASUB}wtkwUM(5E?!o?D33E-fywvHJ_&YCypPRESJB!r-u2zw(3g3 zmZ_(RD}bSLBX0`RZ{M;qtusY324jz4;zHE8oYCevA|StE7W?D2lT+64yK<7}rx3NO z)r-GtQ84L=HzFCyXbnE(yeC&`iNZPExJgpEAS*J(g3++DaG}|GB{MfWv8^dNTpF|6 zeNX>(%ThP}1(oX!=1+raJ7<=i_ikdX=l1=CZW=Nn>+aVzRDE~ug}6lt`tT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^Be$+=_N^wT>Ng9H2k4xs-P zxN-{B9x-Kzj0q&#q4r-MvdNH6QtI2yQBlK$j3KAchwb82i(YO6`3Gdmx*}6Ik>g9)9_$qlsFg?daSqYI@qTM4EjE zK(55SRV9fvhon-%pg<7z`em(vrr|pQM|V+W2Kq~YjJD%|ZMd+tL>y4S1c4MBBTc9F zo-3Ts;(<~i^gL)TxFnyk%FUErAj!m*m!phFLqKzbh`d@TlW7QBOW6cBe48|)<}qUemEeH>(<D80%(~f2@DV3qLWY*7c5YWh6#ow)zd@Ij+ zg!SLr{`(OBIeG{s;o~1i*SGZM9NQc9F;(CCfv*v`qJ|-)_e-&Rn2~ngyh)@a?J$-R z+YSUOEHm*nR5Pn5mg|*cE7X7XR59!jRUatL|8x2LI7m{ZWIW&$0;}1jas0qyjRj=E zTG#g#Mkr7w1Bc8wX*fuuaC`sC&x18K`^!{K9N3lxdo@kHmz;D(gNAwypsf#qZ!Y2O zb7X8)Q^g7bmL3DP6~T20&!5iy(h|rulLL=c0cfie;IXZ|>fdwx*}$OWHb}4qYj7Mh z1@2RyzhQsQyt(5z8;ryRA&G(pqog8gQxsL{g?^nC9x@0D2FX1syDCia3|e**M$(Xwtf3~ zrl2*|JYp9SOrosWc4UD@cV-&BNt(S$19dxhlCKd^F;r@otEbW}819k_{bL`O)PqRW z?o`+9&h9Sje9UbYA;&?dk7t@JlUefxtq&(d7-mK)$c4ytv~qY+gnhVpUPf+3TnLR3 zr>L1hr}I=1.19.0" + }, + "activationEvents": [ + "onCommand:sqlmigration.start" + ], + "main": "./out/main", + "repository": { + "type": "git", + "url": "https://github.com/Microsoft/azuredatastudio.git" + }, + "extensionDependencies": [ + "Microsoft.mssql" + ], + "contributes": { + "commands": [ + { + "command": "sqlmigration.start", + "title": "SQL Migration Start", + "category": "SQL Migration" + } + ] + }, + "dependencies": { + "vscode-nls": "^3.2.1" + }, + "__metadata": { + "publisherDisplayName": "Microsoft", + "publisherId": "Microsoft" + } +} diff --git a/extensions/sql-migration/package.nls.json b/extensions/sql-migration/package.nls.json new file mode 100644 index 0000000000..a535e99221 --- /dev/null +++ b/extensions/sql-migration/package.nls.json @@ -0,0 +1,4 @@ +{ + "displayName": "SQL Migration", + "description": "SQL migration description" +} diff --git a/extensions/sql-migration/src/main.ts b/extensions/sql-migration/src/main.ts new file mode 100644 index 0000000000..29afc2a317 --- /dev/null +++ b/extensions/sql-migration/src/main.ts @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { ExtensionContext, Disposable, commands, window } from 'vscode'; + +class SQLMigration { + + constructor(private readonly context: ExtensionContext) { + } + + async start(): Promise { + + } + + async registerCommands(): Promise { + const commandDisposables: Disposable[] = [ // Array of disposables returned by registerCommand + commands.registerCommand('sqlmigration.start', () => { + window.showInformationMessage('Command ran'); + }), + ]; + + this.context.subscriptions.push(...commandDisposables); + } + + stop(): void { + + } +} + +let sqlMigration: SQLMigration; +export async function activate(context: ExtensionContext) { + sqlMigration = new SQLMigration(context); +} + +export function deactivate(): void { + sqlMigration.stop(); +} diff --git a/extensions/sql-migration/src/models/stateMachine.ts b/extensions/sql-migration/src/models/stateMachine.ts new file mode 100644 index 0000000000..8f710be096 --- /dev/null +++ b/extensions/sql-migration/src/models/stateMachine.ts @@ -0,0 +1,22 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +export enum State { + COLLECTING_SOURCE_INFO, + COLLECTION_SOURCE_INFO_ERROR, + TARGET_SELECTION, + TARGET_SELECTION_ERROR, + AZURE_SERVER_SELECTION, + AZURE_SERVER_SELECTION_ERROR, + AZURE_DB_BACKUP, + AZURE_DB_BACKUP_ERROR, + MIGRATION_AGENT_CREATION, + MIGRATION_AGENT_SELECTION, + MIGRATION_AGENT_ERROR, + MIGRATION_START, + NO_AZURE_SERVER, + EXIT, +} + diff --git a/extensions/sql-migration/src/typings/ref.d.ts b/extensions/sql-migration/src/typings/ref.d.ts new file mode 100644 index 0000000000..cfdf5dd135 --- /dev/null +++ b/extensions/sql-migration/src/typings/ref.d.ts @@ -0,0 +1,9 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +/// +/// +/// +/// diff --git a/extensions/sql-migration/src/wizard/wizardController.ts b/extensions/sql-migration/src/wizard/wizardController.ts new file mode 100644 index 0000000000..f4af019e72 --- /dev/null +++ b/extensions/sql-migration/src/wizard/wizardController.ts @@ -0,0 +1,14 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +export class WizardController { + constructor() { + + } + + public async openWizard(): Promise { + + } +} diff --git a/extensions/sql-migration/tsconfig.json b/extensions/sql-migration/tsconfig.json new file mode 100644 index 0000000000..8a5f06d89b --- /dev/null +++ b/extensions/sql-migration/tsconfig.json @@ -0,0 +1,20 @@ +{ + "extends": "../shared.tsconfig.json", + "compileOnSave": true, + "compilerOptions": { + "module": "commonjs", + "outDir": "./out", + "lib": [ + "es6", "es2015.promise" + ], + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "moduleResolution": "node", + "declaration": false, + "strict": true, + "noUnusedParameters": false, + }, + "exclude": [ + "node_modules" + ] +} diff --git a/extensions/sql-migration/yarn.lock b/extensions/sql-migration/yarn.lock new file mode 100644 index 0000000000..45f8b9278d --- /dev/null +++ b/extensions/sql-migration/yarn.lock @@ -0,0 +1,8 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +vscode-nls@^3.2.1: + version "3.2.5" + resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-3.2.5.tgz#25520c1955108036dec607c85e00a522f247f1a4" + integrity sha512-ITtoh3V4AkWXMmp3TB97vsMaHRgHhsSFPsUdzlueSL+dRZbSNTZeOmdQv60kjCV306ghPxhDeoNUEm3+EZMuyw==