sapo-videos/database.rb

23 lines
606 B
Ruby

# SPDX-License-Identifier: AGPL-3.0-only
# SPDX-FileCopyrightText: 2023 Hugo Peixoto <hugo.peixoto@gmail.com>
require 'active_record'
require 'sqlite3'
ActiveRecord::Base.establish_connection
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Base.logger.level = :warn
ActiveRecord::Schema.define do
create_table :videos, if_not_exists: true do |t|
t.string :randname, index: { unique: true }
t.json :metadata
end
create_table :downloads, if_not_exists: true do |t|
t.references :video, foreign_key: true
t.bigint :size
t.string :sha256
t.string :email
end
end