summaryrefslogtreecommitdiff
path: root/priv/repo/migrations
diff options
context:
space:
mode:
authorSimponic <loganhunt@simponic.xyz>2022-12-30 05:46:35 -0700
committerSimponic <loganhunt@simponic.xyz>2022-12-30 05:46:35 -0700
commit42425b02260d279cd9c12fb3e625282979b9e308 (patch)
tree0412bf9f39d44266cff94082c499e44e5f6e60f5 /priv/repo/migrations
parent60eea1b4ed65bc7cfce1e383dac6de9d004540eb (diff)
downloadchessh-42425b02260d279cd9c12fb3e625282979b9e308.tar.gz
chessh-42425b02260d279cd9c12fb3e625282979b9e308.zip
Add scalable session thresholds
Diffstat (limited to 'priv/repo/migrations')
-rw-r--r--priv/repo/migrations/20221229225556_add_node.exs2
-rw-r--r--priv/repo/migrations/20221229225559_add_user_session.exs6
-rw-r--r--priv/repo/migrations/20221230102253_add_authenticating_column_to_player.exs9
3 files changed, 15 insertions, 2 deletions
diff --git a/priv/repo/migrations/20221229225556_add_node.exs b/priv/repo/migrations/20221229225556_add_node.exs
index f8eace8..11731d9 100644
--- a/priv/repo/migrations/20221229225556_add_node.exs
+++ b/priv/repo/migrations/20221229225556_add_node.exs
@@ -4,7 +4,7 @@ defmodule Chessh.Repo.Migrations.AddNode do
def change do
create table(:nodes, primary_key: false) do
add(:id, :string, primary_key: true)
- add(:last_start, :utc_datetime)
+ add(:last_start, :utc_datetime_usec)
end
end
end
diff --git a/priv/repo/migrations/20221229225559_add_user_session.exs b/priv/repo/migrations/20221229225559_add_user_session.exs
index 6f7a599..330fe2c 100644
--- a/priv/repo/migrations/20221229225559_add_user_session.exs
+++ b/priv/repo/migrations/20221229225559_add_user_session.exs
@@ -3,9 +3,13 @@ defmodule Chessh.Repo.Migrations.AddUserSession do
def change do
create table(:player_sessions) do
- add(:login, :utc_datetime)
+ add(:process, :string)
+ add(:login, :utc_datetime_usec)
+
add(:player_id, references(:players))
add(:node_id, references(:nodes, type: :string))
end
+
+ create(unique_index(:player_sessions, [:process, :node_id]))
end
end
diff --git a/priv/repo/migrations/20221230102253_add_authenticating_column_to_player.exs b/priv/repo/migrations/20221230102253_add_authenticating_column_to_player.exs
new file mode 100644
index 0000000..315aeb6
--- /dev/null
+++ b/priv/repo/migrations/20221230102253_add_authenticating_column_to_player.exs
@@ -0,0 +1,9 @@
+defmodule Chessh.Repo.Migrations.AddAuthenticatingColumnToPlayer do
+ use Ecto.Migration
+
+ def change do
+ alter table(:players) do
+ add(:authentications, :integer, default: 0)
+ end
+ end
+end