Remove tracks

This commit is contained in:
Eugene Burmakin 2025-01-29 12:18:03 +01:00
parent e99e105ab8
commit 8a309a2186
8 changed files with 1 additions and 60 deletions

View file

@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
# 0.23.6 - 2025-01-23
# 0.23.6 - 2025-01-29
### Added

View file

@ -1,7 +0,0 @@
# frozen_string_literal: true
class Track < ApplicationRecord
belongs_to :user
validates :path, :started_at, :ended_at, presence: true
end

View file

@ -14,7 +14,6 @@ class User < ApplicationRecord
has_many :points, through: :imports
has_many :places, through: :visits
has_many :trips, dependent: :destroy
has_many :tracks, dependent: :destroy
after_create :create_api_key
before_save :strip_trailing_slashes

View file

@ -1,14 +0,0 @@
# frozen_string_literal: true
class CreateTracks < ActiveRecord::Migration[8.0]
def change
create_table :tracks do |t|
t.datetime :started_at, null: false
t.datetime :ended_at, null: false
t.references :user, null: false, foreign_key: true
t.line_string :path, srid: 3857, null: false
t.timestamps
end
end
end

11
db/schema.rb generated
View file

@ -193,16 +193,6 @@ ActiveRecord::Schema[8.0].define(version: 2025_01_23_151657) do
t.index ["year"], name: "index_stats_on_year"
end
create_table "tracks", force: :cascade do |t|
t.datetime "started_at", null: false
t.datetime "ended_at", null: false
t.bigint "user_id", null: false
t.geometry "path", limit: {:srid=>3857, :type=>"line_string"}, null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["user_id"], name: "index_tracks_on_user_id"
end
create_table "trips", force: :cascade do |t|
t.string "name", null: false
t.datetime "started_at", null: false
@ -264,7 +254,6 @@ ActiveRecord::Schema[8.0].define(version: 2025_01_23_151657) do
add_foreign_key "points", "users"
add_foreign_key "points", "visits"
add_foreign_key "stats", "users"
add_foreign_key "tracks", "users"
add_foreign_key "trips", "users"
add_foreign_key "visits", "areas"
add_foreign_key "visits", "places"

View file

@ -1,10 +0,0 @@
# frozen_string_literal: true
FactoryBot.define do
factory :track do
started_at { DateTime.new(2025, 1, 23, 15, 59, 55) }
ended_at { DateTime.new(2025, 1, 23, 16, 0, 0) }
user
path { 'LINESTRING(0 0, 1 1, 2 2)' }
end
end

View file

@ -1,15 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Track, type: :model do
describe 'validations' do
it { is_expected.to validate_presence_of(:path) }
it { is_expected.to validate_presence_of(:started_at) }
it { is_expected.to validate_presence_of(:ended_at) }
end
describe 'associations' do
it { is_expected.to belong_to(:user) }
end
end

View file

@ -14,7 +14,6 @@ RSpec.describe User, type: :model do
it { is_expected.to have_many(:visits).dependent(:destroy) }
it { is_expected.to have_many(:places).through(:visits) }
it { is_expected.to have_many(:trips).dependent(:destroy) }
it { is_expected.to have_many(:tracks).dependent(:destroy) }
end
describe 'callbacks' do