Skip to content

Commit

Permalink
Merge pull request #95 from decentraland/feat/add-if-not-exists-to-mi…
Browse files Browse the repository at this point in the history
…gration

feat: add IF NOT EXISTS to remote server migration
  • Loading branch information
juanmahidalgo authored Apr 16, 2024
2 parents f4b8585 + d6b1c4e commit c6519c2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/migrations/1712569914536_fdw-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ export async function up(pgm: MigrationBuilder): Promise<void> {

pgm.sql('CREATE EXTENSION IF NOT EXISTS postgres_fdw;')
pgm.sql(`
CREATE SERVER builder_server
CREATE SERVER IF NOT EXISTS builder_server
FOREIGN DATA WRAPPER postgres_fdw
OPTIONS (host '${builderServerDBHost}', port '${builderServerDBPort}', dbname 'builder');
`)
pgm.sql(`CREATE USER MAPPING FOR ${marketplaceServerDBUser}
pgm.sql(`CREATE USER MAPPING IF NOT EXISTS FOR ${marketplaceServerDBUser}
SERVER builder_server
OPTIONS (user '${builderServerDBUser}', password '${builderServerDBPassword}');`)

pgm.sql(`CREATE FOREIGN TABLE builder_server_items (
pgm.sql(`CREATE FOREIGN TABLE IF NOT EXISTS builder_server_items (
collection_id uuid,
blockchain_item_id text,
data text
)
SERVER builder_server
OPTIONS (schema_name 'public', table_name 'items');
CREATE FOREIGN TABLE builder_server_collections (
CREATE FOREIGN TABLE IF NOT EXISTS builder_server_collections (
id uuid,
contract_address text
)
Expand Down

0 comments on commit c6519c2

Please sign in to comment.