Set sqlite stickied column as NOT NULL, fixes #49

This commit is contained in:
Trevor Slocum 2018-02-14 22:05:19 -08:00
parent 0d59c6d508
commit 2cbdbb9eff
2 changed files with 6 additions and 4 deletions

View File

@ -36,7 +36,8 @@ if (sqlite_num_rows($result) == 0) {
image_height INTEGER NOT NULL DEFAULT '0',
thumb TEXT NOT NULL,
thumb_width INTEGER NOT NULL DEFAULT '0',
thumb_height INTEGER NOT NULL DEFAULT '0'
thumb_height INTEGER NOT NULL DEFAULT '0',
stickied INTEGER NOT NULL DEFAULT '0'
)");
}
@ -53,7 +54,7 @@ if (sqlite_num_rows($result) == 0) {
}
// Add stickied column if it isn't present
sqlite_query($db, "ALTER TABLE " . TINYIB_DBPOSTS . " ADD COLUMN stickied INTEGER");
sqlite_query($db, "ALTER TABLE " . TINYIB_DBPOSTS . " ADD COLUMN stickied INTEGER NOT NULL DEFAULT '0'");
# Post Functions
function uniquePosts() {

View File

@ -37,7 +37,8 @@ if (!$result->fetchArray()) {
image_height INTEGER NOT NULL DEFAULT '0',
thumb TEXT NOT NULL,
thumb_width INTEGER NOT NULL DEFAULT '0',
thumb_height INTEGER NOT NULL DEFAULT '0'
thumb_height INTEGER NOT NULL DEFAULT '0',
stickied INTEGER NOT NULL DEFAULT '0'
)");
}
@ -54,7 +55,7 @@ if (!$result->fetchArray()) {
}
// Add stickied column if it isn't present
@$db->exec("ALTER TABLE " . TINYIB_DBPOSTS . " ADD COLUMN stickied INTEGER");
@$db->exec("ALTER TABLE " . TINYIB_DBPOSTS . " ADD COLUMN stickied INTEGER NOT NULL DEFAULT '0'");
# Post Functions
function uniquePosts() {