Commit 6e0cb049 authored by Mikko Ahlroth's avatar Mikko Ahlroth

Fix username uniqueness and some db changes

* Usernames weren't really unique because the migration was missing the
  word 'create' so a unique index was not created. Now the missing index
  was added
* Dropped useless total_xp column from user
* Change xps and pulses tables ID to bigint in anticipation of MASSIVE
  EXPLOSION OF USERS that is sure to come
* Added licence for logo
parent 3eca2a1a
The source code in this project is licensed with the BSD licence, which
follows:
Copyright © 2016, Mikko Ahlroth
All rights reserved.
......@@ -25,3 +28,37 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------------
The Code::Stats logo is licensed with CC BY-NC-ND 4.0:
Copyright © 2016, Mikko Ahlroth
The following is a summary of the CC BY-NC-ND 4.0 licence. Please see
http://creativecommons.org/licenses/by-nc-nd/4.0/legalcode for the full
licence text.
You are free to:
Share — copy and redistribute the material in any medium or format
The licensor cannot revoke these freedoms as long as you follow the license
terms.
Under the following terms:
Attribution — You must give appropriate credit, provide a link to the license,
and indicate if changes were made. You may do so in any reasonable manner, but
not in any way that suggests the licensor endorses you or your use.
NonCommercial — You may not use the material for commercial purposes.
NoDerivatives — If you remix, transform, or build upon the material, you may
not distribute the modified material.
No additional restrictions — You may not apply legal terms or technological
measures that legally restrict others from doing anything the license permits.
Notices:
You do not have to comply with the license for elements of the material in the
public domain or where your use is permitted by an applicable exception or
limitation.
No warranties are given. The license may not give you all of the permissions
necessary for your intended use. For example, other rights such as publicity,
privacy, or moral rights may limit how you use the material.
......@@ -3,7 +3,7 @@ defmodule CodeStats.Mixfile do
def project do
[app: :code_stats,
version: "1.3.6",
version: "1.3.7",
elixir: "~> 1.2",
elixirc_paths: elixirc_paths(Mix.env),
compilers: [:phoenix, :gettext] ++ Mix.compilers,
......
......@@ -2,7 +2,9 @@ defmodule CodeStats.Repo.Migrations.UsernameUniqueEmailOptional do
use Ecto.Migration
def change do
unique_index(:users, [:username])
# This does not work, `create` was missing.
# This is here only for posterity.
#unique_index(:users, [:username])
alter table(:users) do
modify(:email, :string, null: true)
......
......@@ -2,6 +2,7 @@ defmodule CodeStats.Repo.Migrations.ApiUsernameUnique do
use Ecto.Migration
def change do
unique_index(:users, [:api_username])
# This does not work and is only here to showcase my mistakes
#unique_index(:users, [:api_username])
end
end
defmodule CodeStats.Repo.Migrations.ReallyAddUniqueUsername do
use Ecto.Migration
def change do
# Shameful display :(
create unique_index(:users, [:username])
end
end
defmodule CodeStats.Repo.Migrations.BigintIds do
use Ecto.Migration
def change do
alter table(:users) do
remove :total_xp
end
alter table(:xps) do
modify :id, :bigint
modify :pulse_id, :bigint
end
alter table(:pulses) do
modify :id, :bigint
end
end
end
......@@ -29,6 +29,17 @@
<h2>Changelog</h2>
<h3>1.3.7 – 2016-06-08 – Fix username uniqueness</h3>
<p>
<ul>
<li>Fix username uniqueness, due to a problem with SQL migrations a unique index was not created and multiple users could be registered with the same username. 😱</li>
<li>Change some IDs to bigint because if it's worth doing, it's worth overdoing.</li>
<li>Remove old unused total XP property from users.</li>
<li>Clarified git repo licences a bit.</li>
</ul>
</p>
<h3>1.3.3–1.3.6 – 2016-06-07 – JetBrains and username path fixes</h3>
<p>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment