{"version":3,"file":"sqlite-migrator.mjs","sources":["../../../src/sqlite-migrator.ts"],"sourcesContent":["import {\n  RdbmsSessionStorageMigrator,\n  RdbmsSessionStorageMigratorOptions,\n  MigrationOperation,\n} from '@shopify/shopify-app-session-storage';\n\nimport {SqliteConnection} from './sqlite-connection';\n\nexport class SqliteSessionStorageMigrator extends RdbmsSessionStorageMigrator {\n  constructor(\n    dbConnection: SqliteConnection,\n    opts: Partial<RdbmsSessionStorageMigratorOptions> = {},\n    migrations: MigrationOperation[],\n  ) {\n    super(dbConnection, opts, migrations);\n  }\n\n  async initMigrationPersistence(): Promise<void> {\n    const discardCreateTable = await this.connection.hasTable(\n      this.options.migrationDBIdentifier,\n    );\n\n    if (!discardCreateTable) {\n      const migration = `\n        CREATE TABLE ${this.options.migrationDBIdentifier} (\n          ${\n            this.getOptions().migrationNameColumnName\n          } varchar(255) NOT NULL PRIMARY KEY\n        );`;\n\n      await this.connection.query(migration, []);\n    }\n  }\n}\n"],"names":[],"mappings":";;AAQM,MAAO,4BAA6B,SAAQ,2BAA2B,CAAA;AAC3E,IAAA,WAAA,CACE,YAA8B,EAC9B,IAAA,GAAoD,EAAE,EACtD,UAAgC,EAAA;AAEhC,QAAA,KAAK,CAAC,YAAY,EAAE,IAAI,EAAE,UAAU,CAAC;IACvC;AAEA,IAAA,MAAM,wBAAwB,GAAA;AAC5B,QAAA,MAAM,kBAAkB,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,QAAQ,CACvD,IAAI,CAAC,OAAO,CAAC,qBAAqB,CACnC;QAED,IAAI,CAAC,kBAAkB,EAAE;AACvB,YAAA,MAAM,SAAS,GAAG;uBACD,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAA;AAE7C,UAAA,EAAA,IAAI,CAAC,UAAU,EAAE,CAAC,uBACpB,CAAA;WACC;YAEL,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,SAAS,EAAE,EAAE,CAAC;QAC5C;IACF;AACD;;;;"}