-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change backend database from SQLite to PostgreSQL
As part of our containerization efforts, we need to move to a networked database so that persistent state needn't be stored directly alongside our application. PostgreSQL will also give us a lot less grief about database locking, provide stronger data integrity guarantees, enable us to easily implement atomic database backups, and give us access to much more expressive data types than SQLite. Because this is a major breaking change, it uses the opportunity to establish a new baseline for future database migrations (instead of "migrating" the existing database migrations to the PostgreSQL flavor of SQL). Transferring existing data from SQLite to PostgreSQL is left to the administrator to be performed manually, i.e., without any scripts provided by Accrescent.
- Loading branch information
1 parent
ef90241
commit cb8905d
Showing
27 changed files
with
127 additions
and
261 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
console/src/main/kotlin/app/accrescent/parcelo/console/data/baseline/BaselineEdit.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2024 Logan Magee | ||
// | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
// | ||
// DO NOT MODIFY - DATABASE BASELINE | ||
|
||
package app.accrescent.parcelo.console.data.baseline | ||
|
||
import org.jetbrains.exposed.dao.id.UUIDTable | ||
import org.jetbrains.exposed.sql.ReferenceOption | ||
|
||
object BaselineEdits : UUIDTable("edits") { | ||
val appId = reference("app_id", BaselineApps, ReferenceOption.CASCADE) | ||
val shortDescription = text("short_description").nullable() | ||
val creationTime = long("creation_time").clientDefault { System.currentTimeMillis() / 1000 } | ||
val reviewerId = | ||
reference("reviewer_id", BaselineReviewers, ReferenceOption.NO_ACTION).nullable() | ||
val reviewId = reference("review_id", BaselineReviews, ReferenceOption.NO_ACTION).nullable() | ||
val published = bool("published").default(false) | ||
|
||
init { | ||
check { | ||
// At least one metadata field must be non-null | ||
shortDescription.isNotNull() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
console/src/main/kotlin/app/accrescent/parcelo/console/data/baseline/BaselineListing.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2024 Logan Magee | ||
// | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
// | ||
// DO NOT MODIFY - DATABASE BASELINE | ||
|
||
package app.accrescent.parcelo.console.data.baseline | ||
|
||
import org.jetbrains.exposed.dao.id.IntIdTable | ||
import org.jetbrains.exposed.sql.ReferenceOption | ||
|
||
object BaselineListings : IntIdTable("listings") { | ||
val appId = reference("app_id", BaselineApps, ReferenceOption.CASCADE) | ||
val locale = text("locale") | ||
val iconId = reference("icon_id", BaselineIcons, ReferenceOption.NO_ACTION) | ||
val label = text("label") | ||
val shortDescription = text("short_description") | ||
|
||
init { | ||
uniqueIndex(appId, locale) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 0 additions & 65 deletions
65
console/src/main/kotlin/db/migration/V10__Save_repodata_to_database.kt
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
console/src/main/resources/db/migration/V11__Make_repository_metadata_not_null.sql
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
console/src/main/resources/db/migration/V12__Add_s3_object_key_field_to_file.sql
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
console/src/main/resources/db/migration/V13__Remove_local_path_column_from_file.sql
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
console/src/main/resources/db/migration/V2__Add_edit_metadata_access_control.sql
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.