diff --git a/app/models/mirror_repository.rb b/app/models/mirror_repository.rb new file mode 100644 index 000000000..b6904e1b6 --- /dev/null +++ b/app/models/mirror_repository.rb @@ -0,0 +1,5 @@ +class MirrorRepository < ActiveRecord::Base + has_many :mirror_update_records + has_many :mirror_repository_types + attr_accessible :description, :mirrorID, :name, :status, :tag, :main_type +end diff --git a/app/models/mirror_repository_type.rb b/app/models/mirror_repository_type.rb new file mode 100644 index 000000000..4d1208ef4 --- /dev/null +++ b/app/models/mirror_repository_type.rb @@ -0,0 +1,5 @@ +class MirrorRepositoryType < ActiveRecord::Base + belongs_to :mirror_type + belongs_to :mirror_repository + # attr_accessible :title, :body +end diff --git a/app/models/mirror_type.rb b/app/models/mirror_type.rb new file mode 100644 index 000000000..0eb1f4dfd --- /dev/null +++ b/app/models/mirror_type.rb @@ -0,0 +1,5 @@ +class MirrorType < ActiveRecord::Base + belongs_to :user + has_many :mirror_repository_types + attr_accessible :name, :user_id +end diff --git a/app/models/mirror_update_record.rb b/app/models/mirror_update_record.rb new file mode 100644 index 000000000..9ef160e1a --- /dev/null +++ b/app/models/mirror_update_record.rb @@ -0,0 +1,5 @@ +class MirrorUpdateRecord < ActiveRecord::Base + belongs_to :user + belongs_to :mirror_repository + attr_accessible :newDescription, :newName, :newStatus, :newTag, :newType, :oldDescription, :oldName, :oldStatus, :oldTag, :oldType, :user_id, :mirror_repository_id +end diff --git a/db/migrate/20170822032004_create_mirror_types.rb b/db/migrate/20170822032004_create_mirror_types.rb new file mode 100644 index 000000000..956db2de1 --- /dev/null +++ b/db/migrate/20170822032004_create_mirror_types.rb @@ -0,0 +1,10 @@ +class CreateMirrorTypes < ActiveRecord::Migration + def change + create_table :mirror_types do |t| + t.string :name + t.references :user + + t.timestamps + end + end +end diff --git a/db/migrate/20170822032223_create_mirror_repositories.rb b/db/migrate/20170822032223_create_mirror_repositories.rb new file mode 100644 index 000000000..64223246f --- /dev/null +++ b/db/migrate/20170822032223_create_mirror_repositories.rb @@ -0,0 +1,14 @@ +class CreateMirrorRepositories < ActiveRecord::Migration + def change + create_table :mirror_repositories do |t| + t.string :mirrorID + t.string :name + t.string :main_type + t.string :tag + t.text :description + t.integer :status + + t.timestamps + end + end +end diff --git a/db/migrate/20170822032810_create_mirror_repository_types.rb b/db/migrate/20170822032810_create_mirror_repository_types.rb new file mode 100644 index 000000000..480f4fcb6 --- /dev/null +++ b/db/migrate/20170822032810_create_mirror_repository_types.rb @@ -0,0 +1,12 @@ +class CreateMirrorRepositoryTypes < ActiveRecord::Migration + def change + create_table :mirror_repository_types do |t| + t.references :mirror_type + t.references :mirror_repository + + t.timestamps + end + add_index :mirror_repository_types, :mirror_type_id + add_index :mirror_repository_types, :mirror_repository_id + end +end diff --git a/db/migrate/20170822062358_create_mirror_update_records.rb b/db/migrate/20170822062358_create_mirror_update_records.rb new file mode 100644 index 000000000..2e5efe4a4 --- /dev/null +++ b/db/migrate/20170822062358_create_mirror_update_records.rb @@ -0,0 +1,22 @@ +class CreateMirrorUpdateRecords < ActiveRecord::Migration + def change + create_table :mirror_update_records do |t| + t.references :user + t.references :mirror_repository + t.string :oldName + t.string :newName + t.string :oldType + t.string :newType + t.text :oldTag + t.text :newTag + t.text :oldDescription + t.text :newDescription + t.integer :oldStatus + t.integer :newStatus + + t.timestamps + end + add_index :mirror_update_records, :user_id + add_index :mirror_update_records, :mirror_repository_id + end +end diff --git a/spec/factories/mirror_repositories.rb b/spec/factories/mirror_repositories.rb new file mode 100644 index 000000000..e9c9b0429 --- /dev/null +++ b/spec/factories/mirror_repositories.rb @@ -0,0 +1,10 @@ +FactoryGirl.define do + factory :mirror_repository do + mirrorID "MyString" +name "MyString" +tag "MyText" +description "MyText" +status 1 + end + +end diff --git a/spec/factories/mirror_repository_types.rb b/spec/factories/mirror_repository_types.rb new file mode 100644 index 000000000..c70850cf2 --- /dev/null +++ b/spec/factories/mirror_repository_types.rb @@ -0,0 +1,7 @@ +FactoryGirl.define do + factory :mirror_repository_type do + mirror_type nil +mirror_repository nil + end + +end diff --git a/spec/factories/mirror_types.rb b/spec/factories/mirror_types.rb new file mode 100644 index 000000000..84557e448 --- /dev/null +++ b/spec/factories/mirror_types.rb @@ -0,0 +1,6 @@ +FactoryGirl.define do + factory :mirror_type do + name "MyString" + end + +end diff --git a/spec/factories/mirror_update_records.rb b/spec/factories/mirror_update_records.rb new file mode 100644 index 000000000..6bb631e82 --- /dev/null +++ b/spec/factories/mirror_update_records.rb @@ -0,0 +1,16 @@ +FactoryGirl.define do + factory :mirror_update_record do + user nil +oldName "MyString" +newName "MyString" +oldType "MyString" +newType "MyString" +oldTag "MyText" +newTag "MyText" +oldDescription "MyText" +newDescription "MyText" +oldStatus 1 +newStatus 1 + end + +end diff --git a/spec/models/mirror_repository_spec.rb b/spec/models/mirror_repository_spec.rb new file mode 100644 index 000000000..a991267d3 --- /dev/null +++ b/spec/models/mirror_repository_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe MirrorRepository, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/mirror_repository_type_spec.rb b/spec/models/mirror_repository_type_spec.rb new file mode 100644 index 000000000..2f0f16796 --- /dev/null +++ b/spec/models/mirror_repository_type_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe MirrorRepositoryType, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/mirror_type_spec.rb b/spec/models/mirror_type_spec.rb new file mode 100644 index 000000000..55eaafa94 --- /dev/null +++ b/spec/models/mirror_type_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe MirrorType, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/mirror_update_record_spec.rb b/spec/models/mirror_update_record_spec.rb new file mode 100644 index 000000000..8460b7ebd --- /dev/null +++ b/spec/models/mirror_update_record_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe MirrorUpdateRecord, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end