Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gab-social
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
gab
social
gab-social
Commits
044e9695
Commit
044e9695
authored
Aug 31, 2019
by
2458773093
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
model/migration for promoted statuses
parent
3b1cfd42
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
6 deletions
+44
-6
app/models/promotion.rb
app/models/promotion.rb
+18
-0
db/migrate/20190903162122_create_promotions.rb
db/migrate/20190903162122_create_promotions.rb
+11
-0
db/schema.rb
db/schema.rb
+15
-6
No files found.
app/models/promotion.rb
0 → 100644
View file @
044e9695
# == Schema Information
#
# Table name: promotions
#
# id :bigint(8) not null, primary key
# created_at :datetime not null
# updated_at :datetime not null
# expires_at :datetime
# status_id :bigint(8) not null
# timeline_id :string
# position :integer default(10)
#
class
Promotion
<
ApplicationRecord
belongs_to
:status
scope
:active
,
->
{
where
(
'expires_at > ?'
,
[
Time
.
now
])
}
end
db/migrate/20190903162122_create_promotions.rb
0 → 100644
View file @
044e9695
class
CreatePromotions
<
ActiveRecord
::
Migration
[
5.2
]
def
change
create_table
:promotions
do
|
t
|
t
.
timestamps
t
.
datetime
:expires_at
,
null:
true
t
.
bigint
:status_id
,
null:
false
t
.
string
:timeline_id
,
null:
true
t
.
integer
:position
,
default:
10
end
end
end
db/schema.rb
View file @
044e9695
...
...
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
2019_0
8_04_115634
)
do
ActiveRecord
::
Schema
.
define
(
version:
2019_0
9_03_162122
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
@@ -93,7 +93,7 @@ ActiveRecord::Schema.define(version: 2019_08_04_115634) do
t
.
bigint
"account_id"
t
.
string
"image_file_name"
t
.
string
"image_content_type"
t
.
bigint
"image_file_size"
t
.
integer
"image_file_size"
t
.
datetime
"image_updated_at"
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
...
...
@@ -157,10 +157,10 @@ ActiveRecord::Schema.define(version: 2019_08_04_115634) do
t
.
string
"actor_type"
t
.
boolean
"discoverable"
t
.
string
"also_known_as"
,
array:
true
t
.
datetime
"silenced_at"
t
.
datetime
"suspended_at"
t
.
boolean
"is_pro"
,
default:
false
,
null:
false
t
.
datetime
"pro_expires_at"
t
.
datetime
"silenced_at"
t
.
datetime
"suspended_at"
t
.
boolean
"is_verified"
,
default:
false
,
null:
false
t
.
boolean
"is_donor"
,
default:
false
,
null:
false
t
.
boolean
"is_investor"
,
default:
false
,
null:
false
...
...
@@ -578,6 +578,15 @@ ActiveRecord::Schema.define(version: 2019_08_04_115634) do
t
.
index
[
"status_id"
,
"preview_card_id"
],
name:
"index_preview_cards_statuses_on_status_id_and_preview_card_id"
end
create_table
"promotions"
,
force: :cascade
do
|
t
|
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
t
.
datetime
"expires_at"
t
.
bigint
"status_id"
,
null:
false
t
.
string
"timeline_id"
t
.
integer
"position"
,
default:
10
end
create_table
"relays"
,
force: :cascade
do
|
t
|
t
.
string
"inbox_url"
,
default:
""
,
null:
false
t
.
string
"follow_activity_id"
...
...
@@ -658,8 +667,8 @@ ActiveRecord::Schema.define(version: 2019_08_04_115634) do
create_table
"status_pins"
,
force: :cascade
do
|
t
|
t
.
bigint
"account_id"
,
null:
false
t
.
bigint
"status_id"
,
null:
false
t
.
datetime
"created_at"
,
default:
->
{
"
now()
"
},
null:
false
t
.
datetime
"updated_at"
,
default:
->
{
"
now()
"
},
null:
false
t
.
datetime
"created_at"
,
default:
->
{
"
CURRENT_TIMESTAMP
"
},
null:
false
t
.
datetime
"updated_at"
,
default:
->
{
"
CURRENT_TIMESTAMP
"
},
null:
false
t
.
index
[
"account_id"
,
"status_id"
],
name:
"index_status_pins_on_account_id_and_status_id"
,
unique:
true
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment