class CreateProjectLanguages < ActiveRecord::Migration[5.2]
  def change
    create_table :project_languages do |t|
      t.string :name
      t.integer :position
      t.integer :projects_count, :default => 0

      t.timestamps
    end

    names = %w(Ruby C C# C++ HTML Haml CSS JavaScript Python PHP Java JSON JSX Lex Shell Objective-C Cycript Clojure Go Grace Gradle GraphQL Dart Elixir Erlang Perl R Reason Sass Slice SVG)
    names.each do |name|
      ProjectLanguage.find_or_create_by!(name: name)
    end

  end
end
