KichangKim/DanbooruDownloader

SQLite Error 1: 'table posts has no column named media_asset

nemson-source opened this issue · 1 comments

i got this Problem for a day and i don't know from were it is

i found the problem and fixt it
here is the fix

  1. add var media_asset = jsonObject.GetValue("media_asset").ToString(); at the end of

try
{
var id = jsonObject.GetValue("id").ToString();
var md5 = jsonObject.GetValue("md5")?.ToString() ?? "";
var extension = jsonObject.GetValue("file_ext")?.ToString() ?? "";
var imageUrl = jsonObject.GetValue("file_url")?.ToString() ?? "";
var createdDate = DateTime.Parse(jsonObject.GetValue("created_at").ToString());
var updatedDate = jsonObject.GetValue("updated_at") != null ? DateTime.Parse(jsonObject.GetValue("updated_at").ToString()) : DateTime.Parse(jsonObject.GetValue("created_at").ToString());
var isDeleted = jsonObject.GetValue("is_deleted")?.ToObject() ?? false;
var isPending = jsonObject.GetValue("is_pending")?.ToObject() ?? false;
var media_asset = jsonObject.GetValue("media_asset").ToString();

in the file DumpCommand.cs
2. in the same file ( DumpCommand.cs ) below the 1. code add media_asset = media_asset, at the end of Md5 = md5, from this block of code

Post post = new Post()
{
Id = id,
Md5 = md5,
media_asset = media_asset,
Extension = extension,
ImageUrl = imageUrl,
CreatedDate = createdDate,
UpdatedDate = updatedDate,
IsDeleted = isDeleted,
IsPending = isPending,
JObject = jsonObject,
};

  1. in the same file ( DumpCommand.cs ) at the end add public string media_asset; below public string ImageUrl; in this block of code
    class Post
    {
    public string Id;
    public string Md5;
    public string Extension;
    public string ImageUrl;
    public string media_asset;
    public DateTime CreatedDate;
    public DateTime UpdatedDate;
    public bool IsPending;
    public bool IsDeleted;
    public JObject JObject;
    public bool IsValid;
    public bool ShouldSaveMetadata;
    public bool ShouldDownloadImage;
    public bool ShouldUpdateImage;
    }
  2. in the file SQLiteUtility.cs add media_asset at the end of this block of code

CREATE TABLE IF NOT EXISTS posts
(
id INTEGER NOT NULL PRIMARY KEY,
created_at INTEGER,
uploader_id INTEGER,
score INTEGER,
source TEXT,
md5 TEXT,
last_comment_bumped_at INTEGER,
rating TEXT,
image_width INTEGER,
image_height INTEGER,
tag_string TEXT,
is_note_locked INTEGER,
fav_count INTEGER,
file_ext TEXT,
last_noted_at INTEGER,
is_rating_locked INTEGER,
parent_id INTEGER,
has_children INTEGER,
approver_id INTEGER,
tag_count_general INTEGER,
tag_count_artist INTEGER,
tag_count_character INTEGER,
tag_count_copyright INTEGER,
file_size INTEGER,
is_status_locked INTEGER,
pool_string TEXT,
up_score INTEGER,
down_score INTEGER,
is_pending INTEGER,
is_flagged INTEGER,
is_deleted INTEGER,
tag_count INTEGER,
updated_at INTEGER,
is_banned INTEGER,
pixiv_id INTEGER,
pixiv_ugoira_frame_data TEXT,
last_commented_at INTEGER,
has_active_children INTEGER,
bit_flags INTEGER,
tag_count_meta INTEGER,
keeper_data TEXT,
uploader_name TEXT,
has_large INTEGER,
has_visible_children INTEGER,
children_ids TEXT,
is_favorited INTEGER,
tag_string_general TEXT,
tag_string_character TEXT,
tag_string_copyright TEXT,
tag_string_artist TEXT,
tag_string_meta TEXT,
file_url TEXT,
large_file_url TEXT,
preview_file_url TEXT,
media_asset
);";