Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correcting Database Column Renaming from PR #235 #241

Merged
merged 2 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions pkg/server/db/postgres/migrations/1_initialize_schema.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ CREATE TABLE IF NOT EXISTS relationships

CREATE TABLE IF NOT EXISTS bundles
(
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
trust_domain_id UUID NOT NULL UNIQUE,
data BYTEA NOT NULL,
digest BYTEA NOT NULL,
signature BYTEA,
signing_certificate_chain BYTEA,
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now()
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
trust_domain_id UUID NOT NULL UNIQUE,
data BYTEA NOT NULL,
digest BYTEA NOT NULL,
signature BYTEA,
signing_certificate BYTEA,
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now()
);

CREATE TABLE IF NOT EXISTS join_tokens
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE bundles
RENAME signing_certificate_chain TO signing_certificate;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE bundles
RENAME signing_certificate TO signing_certificate_chain;
2 changes: 1 addition & 1 deletion pkg/server/db/postgres/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var fs embed.FS
// This is used to ensure that the app is compatible with the database schema.
// When a new migration is created, this version should be updated in order to force
// the migrations to run when starting up the app.
const currentDBVersion = 1
const currentDBVersion = 2

const scheme = "postgresql"

Expand Down
16 changes: 8 additions & 8 deletions pkg/server/db/sqlite/migrations/1_initialize_schema.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ CREATE TABLE IF NOT EXISTS relationships

CREATE TABLE IF NOT EXISTS bundles
(
id TEXT PRIMARY KEY,
trust_domain_id TEXT NOT NULL UNIQUE,
data BLOB NOT NULL,
digest BLOB NOT NULL,
signature BLOB,
signing_certificate_chain BLOB,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
id TEXT PRIMARY KEY,
trust_domain_id TEXT NOT NULL UNIQUE,
data BLOB NOT NULL,
digest BLOB NOT NULL,
signature BLOB,
signing_certificate BLOB,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (trust_domain_id)
REFERENCES trust_domains (id)
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE bundles
RENAME signing_certificate_chain TO signing_certificate;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE bundles
RENAME signing_certificate TO signing_certificate_chain;
2 changes: 1 addition & 1 deletion pkg/server/db/sqlite/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var fs embed.FS
// This is used to ensure that the app is compatible with the database schema.
// When a new migration is created, this version should be updated in order to force
// the migrations to run when starting up the app.
const currentDBVersion = 1
const currentDBVersion = 2

const scheme = "sqlite3"

Expand Down