<commit_before>defmodule Fanuniverse.Repo.Migrations.Skeleton do
  use Ecto.Migration

  def change do
    add_by_sql_script "functions/counter_cache_incr.sql"
    add_by_sql_script "functions/counter_cache_update.sql"

    execute "CREATE EXTENSION pg_similarity;"

    users()
    images()
    comments()
    stars()
    reports()
  end

  def users do
    create table(:users) do
      add :name, :text
      add :email, :text
      add :password_hash, :text

      add :role, :text
      add :avatar_file_ext, :text

      timestamps()
    end<commit_msg>don't CREATE EXTENSION in prod<commit_after>defmodule Fanuniverse.Repo.Migrations.Skeleton do
  use Ecto.Migration

  def change do
    add_by_sql_script "functions/counter_cache_incr.sql"
    add_by_sql_script "functions/counter_cache_update.sql"

    # Ensure we're not in production (otherwise the extension is already there)
    if Code.ensure_loaded?(Mix),
      do: execute "CREATE EXTENSION pg_similarity;"

    users()
    images()
    comments()
    stars()
    reports()
  end

  def users do
    create table(:users) do
      add :name, :text
      add :email, :text
      add :password_hash, :text

      add :role, :text
      add :avatar_file_ext, :text

      timestamps()
    end
{'fraction_non_alphanumeric': 0.08532695374800638, 'fraction_numerical': 0.0, 'mean_word_length': 2.984126984126984, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5621652', 'n_tokens_mistral': 428, 'n_tokens_neox': 411, 'n_words': 107}