Make the author field nullable #117

Merged
AmineB merged 3 commits from davidoskky/ReaderForSelfoss-multiplatform:author into master 2022-12-28 14:25:38 +00:00
4 changed files with 5 additions and 5 deletions
Showing only changes of commit 5227751dca - Show all commits
@@ -46,7 +46,7 @@ data class ParecelableItem(
val link: String,
val sourcetitle: String,
val tags: String,
val author: String
val author: String?
) : Parcelable {
companion object {
@@ -73,7 +73,7 @@ class SelfossModel {
val sourcetitle: String,
@Serializable(with = TagsListSerializer::class)
val tags: List<String>,
val author: String
val author: String?
) {
// TODO: maybe find a better way to handle these kind of urls
fun getLinkDecoded(): String {
@@ -104,7 +104,7 @@ class SelfossModel {
fun sourceAuthorAndDate(): String {
var txt = this.sourcetitle.getHtmlDecoded()
if (this.author.isNotEmpty()) {
if (!this.author.isNullOrBlank()) {
txt += " (by ${this.author}) "
}
txt += DateUtils.parseRelativeDate(this.datetime)
4
@@ -1 +1 @@
ALTER TABLE ITEM ADD COLUMN `author` TEXT NOT NULL;
ALTER TABLE ITEM ADD COLUMN `author` TEXT;
Outdated
Review

You can´t update a sqldelight migration file. You have to create a new file 2.sq and add the sql query changing the column inside.

You can´t update a sqldelight migration file. You have to create a new file `2.sq` and add the sql query changing the column inside.
Outdated
Review

Ops, I thought this version hadn't been released yet and that thus that would be fine.

Ops, I thought this version hadn't been released yet and that thus that would be fine.
Outdated
Review

I just saw that you can't update a column type in sqlite.

You'll have to rename the existing one create a new one with the old name and the right type, and then drop the old one.(not possible in older versions of android because it's only available since version 3.25.0 of sqlite, and Android has old versions)

You'll have to drop the old column, and recreate it.

Will you be able to do these changes today ? This seem to cause issues for multiple users.

I just saw that you [can't update a column type in sqlite](https://www.sqlite.org/lang_altertable.html#alter_table_rename_column). ~~You'll have to rename the existing one create a new one with the old name and the right type, and then drop the old one.~~(not possible in older versions of android because it's only available since version 3.25.0 of sqlite, and Android has [old versions](https://stackoverflow.com/a/52346199)) You'll have to drop the old column, and recreate it. Will you be able to do these changes today ? This seem to cause issues for multiple users.
Outdated
Review

Yes, I'll submit everything soon.

Yes, I'll submit everything soon.
@@ -10,7 +10,7 @@ CREATE TABLE ITEM (
`link` TEXT NOT NULL,
`sourcetitle` TEXT NOT NULL,
`tags` TEXT NOT NULL,
`author` TEXT NOT NULL,
`author` TEXT,
PRIMARY KEY(`id`)
);