From fef29917c688da707f3a49871efda72010042155 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= <ast@a5n.dk>
Date: Thu, 7 Nov 2024 21:50:31 +0000
Subject: schema: add if not exists
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Asbjørn Sloth Tønnesen <ast@a5n.dk>
---
 schema.sql | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

(limited to 'schema.sql')

diff --git a/schema.sql b/schema.sql
index f658f38..7c48bc8 100644
--- a/schema.sql
+++ b/schema.sql
@@ -1,6 +1,6 @@
-create schema peeringdb;
+CREATE SCHEMA IF NOT EXISTS peeringdb;
 
-create table peeringdb.org (
+CREATE TABLE IF NOT EXISTS peeringdb.org (
 	id int not null,
 	status text not null,
 	data jsonb not null,
@@ -10,7 +10,7 @@ create table peeringdb.org (
 	primary key (id)
 );
 
-create table peeringdb.net (
+CREATE TABLE IF NOT EXISTS peeringdb.net (
 	id int not null,
 	org_id int not null,
 	asn bigint not null,
@@ -22,7 +22,7 @@ create table peeringdb.net (
 	primary key (id)
 );
 
-create table peeringdb.ix (
+CREATE TABLE IF NOT EXISTS peeringdb.ix (
 	id int not null,
 	org_id int not null,
 	status text not null,
@@ -33,7 +33,7 @@ create table peeringdb.ix (
 	primary key (id)
 );
 
-create table peeringdb.fac (
+CREATE TABLE IF NOT EXISTS peeringdb.fac (
 	id int not null,
 	org_id int not null,
 	status text not null,
@@ -44,7 +44,7 @@ create table peeringdb.fac (
 	primary key (id)
 );
 
-create table peeringdb.poc (
+CREATE TABLE IF NOT EXISTS peeringdb.poc (
 	id int not null,
 	net_id int not null,
 	status text not null,
@@ -55,7 +55,7 @@ create table peeringdb.poc (
 	primary key (id)
 );
 
-create table peeringdb.ixlan (
+CREATE TABLE IF NOT EXISTS peeringdb.ixlan (
 	id int not null,
 	ix_id int not null,
 	status text not null,
@@ -66,7 +66,7 @@ create table peeringdb.ixlan (
 	primary key (id)
 );
 
-create table peeringdb.ixpfx (
+CREATE TABLE IF NOT EXISTS peeringdb.ixpfx (
 	id int not null,
 	ixlan_id int not null,
 	status text not null,
@@ -77,7 +77,7 @@ create table peeringdb.ixpfx (
 	primary key (id)
 );
 
-create table peeringdb.ixfac (
+CREATE TABLE IF NOT EXISTS peeringdb.ixfac (
 	id int not null,
 	ix_id int not null,
 	fac_id int not null,
@@ -89,7 +89,7 @@ create table peeringdb.ixfac (
 	primary key (id)
 );
 
-create table peeringdb.netfac (
+CREATE TABLE IF NOT EXISTS peeringdb.netfac (
 	id int not null,
 	net_id int not null,
 	fac_id int not null,
@@ -101,7 +101,7 @@ create table peeringdb.netfac (
 	primary key (id)
 );
 
-create table peeringdb.netixlan (
+CREATE TABLE IF NOT EXISTS peeringdb.netixlan (
 	id int not null,
 	net_id int not null,
 	ix_id int not null,
-- 
cgit v1.2.1

