Convert enclosure size field to bigint
This commit is contained in:
parent
fec391a336
commit
482785c5e6
7 changed files with 9 additions and 6 deletions
|
@ -11,7 +11,7 @@ type Enclosure struct {
|
||||||
EntryID int64 `json:"entry_id"`
|
EntryID int64 `json:"entry_id"`
|
||||||
URL string `json:"url"`
|
URL string `json:"url"`
|
||||||
MimeType string `json:"mime_type"`
|
MimeType string `json:"mime_type"`
|
||||||
Size int `json:"size"`
|
Size int64 `json:"size"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// EnclosureList represents a list of attachments.
|
// EnclosureList represents a list of attachments.
|
||||||
|
|
|
@ -187,7 +187,7 @@ func getEnclosures(a *atomEntry) model.EnclosureList {
|
||||||
|
|
||||||
for _, link := range a.Links {
|
for _, link := range a.Links {
|
||||||
if strings.ToLower(link.Rel) == "enclosure" {
|
if strings.ToLower(link.Rel) == "enclosure" {
|
||||||
length, _ := strconv.Atoi(link.Length)
|
length, _ := strconv.ParseInt(link.Length, 10, 0)
|
||||||
enclosures = append(enclosures, &model.Enclosure{URL: link.URL, MimeType: link.Type, Size: length})
|
enclosures = append(enclosures, &model.Enclosure{URL: link.URL, MimeType: link.Type, Size: length})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ type jsonAttachment struct {
|
||||||
URL string `json:"url"`
|
URL string `json:"url"`
|
||||||
MimeType string `json:"mime_type"`
|
MimeType string `json:"mime_type"`
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
Size int `json:"size_in_bytes"`
|
Size int64 `json:"size_in_bytes"`
|
||||||
Duration int `json:"duration_in_seconds"`
|
Duration int `json:"duration_in_seconds"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -194,7 +194,7 @@ func (r *rssItem) GetEnclosures() model.EnclosureList {
|
||||||
enclosures := make(model.EnclosureList, 0)
|
enclosures := make(model.EnclosureList, 0)
|
||||||
|
|
||||||
for _, enclosure := range r.Enclosures {
|
for _, enclosure := range r.Enclosures {
|
||||||
length, _ := strconv.Atoi(enclosure.Length)
|
length, _ := strconv.ParseInt(enclosure.Length, 10, 0)
|
||||||
enclosureURL := enclosure.URL
|
enclosureURL := enclosure.URL
|
||||||
|
|
||||||
if r.OrigEnclosureLink != "" {
|
if r.OrigEnclosureLink != "" {
|
||||||
|
|
1
sql/schema_version_15.sql
Normal file
1
sql/schema_version_15.sql
Normal file
|
@ -0,0 +1 @@
|
||||||
|
alter table enclosures alter column size set data type bigint;
|
|
@ -1,5 +1,5 @@
|
||||||
// Code generated by go generate; DO NOT EDIT.
|
// Code generated by go generate; DO NOT EDIT.
|
||||||
// 2018-02-24 17:47:34.98646993 +0000 GMT
|
// 2018-03-14 19:16:10.293618552 -0700 PDT m=+0.003182755
|
||||||
|
|
||||||
package sql
|
package sql
|
||||||
|
|
||||||
|
@ -129,6 +129,7 @@ create index feeds_user_category_idx on feeds(user_id, category_id);
|
||||||
"schema_version_14": `alter table integrations add column nunux_keeper_enabled bool default 'f';
|
"schema_version_14": `alter table integrations add column nunux_keeper_enabled bool default 'f';
|
||||||
alter table integrations add column nunux_keeper_url text default '';
|
alter table integrations add column nunux_keeper_url text default '';
|
||||||
alter table integrations add column nunux_keeper_api_key text default '';`,
|
alter table integrations add column nunux_keeper_api_key text default '';`,
|
||||||
|
"schema_version_15": `alter table enclosures alter column size set data type bigint;`,
|
||||||
"schema_version_2": `create extension if not exists hstore;
|
"schema_version_2": `create extension if not exists hstore;
|
||||||
alter table users add column extra hstore;
|
alter table users add column extra hstore;
|
||||||
create index users_extra_idx on users using gin(extra);
|
create index users_extra_idx on users using gin(extra);
|
||||||
|
@ -174,6 +175,7 @@ var SqlMapChecksums = map[string]string{
|
||||||
"schema_version_12": "a95abab6cdf64811fc744abd37457e2928939d999c5ef00d2bdd9398e16f32fb",
|
"schema_version_12": "a95abab6cdf64811fc744abd37457e2928939d999c5ef00d2bdd9398e16f32fb",
|
||||||
"schema_version_13": "9073fae1e796936f4a43a8120ebdb4218442fe7d346ace6387556a357c2d7edf",
|
"schema_version_13": "9073fae1e796936f4a43a8120ebdb4218442fe7d346ace6387556a357c2d7edf",
|
||||||
"schema_version_14": "4622e42c4a5a88b6fe1e61f3d367b295968f7260ab5b96481760775ba9f9e1fe",
|
"schema_version_14": "4622e42c4a5a88b6fe1e61f3d367b295968f7260ab5b96481760775ba9f9e1fe",
|
||||||
|
"schema_version_15": "13ff91462bdf4cda5a94a4c7a09f757761b0f2c32b4be713ba4786a4837750e4",
|
||||||
"schema_version_2": "e8e9ff32478df04fcddad10a34cba2e8bb1e67e7977b5bd6cdc4c31ec94282b4",
|
"schema_version_2": "e8e9ff32478df04fcddad10a34cba2e8bb1e67e7977b5bd6cdc4c31ec94282b4",
|
||||||
"schema_version_3": "a54745dbc1c51c000f74d4e5068f1e2f43e83309f023415b1749a47d5c1e0f12",
|
"schema_version_3": "a54745dbc1c51c000f74d4e5068f1e2f43e83309f023415b1749a47d5c1e0f12",
|
||||||
"schema_version_4": "216ea3a7d3e1704e40c797b5dc47456517c27dbb6ca98bf88812f4f63d74b5d9",
|
"schema_version_4": "216ea3a7d3e1704e40c797b5dc47456517c27dbb6ca98bf88812f4f63d74b5d9",
|
||||||
|
|
|
@ -12,7 +12,7 @@ import (
|
||||||
"github.com/miniflux/miniflux/sql"
|
"github.com/miniflux/miniflux/sql"
|
||||||
)
|
)
|
||||||
|
|
||||||
const schemaVersion = 14
|
const schemaVersion = 15
|
||||||
|
|
||||||
// Migrate run database migrations.
|
// Migrate run database migrations.
|
||||||
func (s *Storage) Migrate() {
|
func (s *Storage) Migrate() {
|
||||||
|
|
Loading…
Reference in a new issue