glen

glen

Make Mariadb / Mysql the default database instance instead of requiring -database flag

Is there a way to change the default database instance from Postgres to Mariadb or Mysql for ecto? I am aware of the option to use the database flag, but since I have years more experience with mysql, I’d love to make it the default.

Most Liked

kokolegorille

kokolegorille

I would recommend to use postgresql if You want to follow tutorials, because there are some differences with mysql. Almost all tutorials I saw use it.

like ordering, or search case sensitivity, or extensions (citext, postgis etc).

I have often used mysql with Rails, but once I had to use windows functions. I don’t know if it is supported by mysql now, but 5 years ago it was not.

It’s always possible to switch later.

John-Goff

John-Goff

I would recommend using postgres, I started with MySQL and while it worked fine, there was a subset of ecto features that I wanted to use which required using postgres. Though switching from mysql to postgres was relatively painless all things considered, so if you do decide to go with one and then change your mind it should be doable. But yeah I wouldn’t bother modifying the script for phx.new, just use the --database flag or like I said earlier, wrap it in a bash script.

John-Goff

John-Goff

I do not believe that there is any kind of config file or anything that you could set to make your choice of database the default. I think that generally the generators are only used once when creating a project, so I’m not sure that adding such an option would be all that beneficial. If you are in fact creating new Phoenix projects on the regular you could always create a bash script which passes the flags you would like.

kokolegorille

kokolegorille

You can always make some kind of shell alias if You really want to avoid typing –database mysql.

But You cannot change default value of phx.new

OvermindDL1

OvermindDL1

You could, however, fork it and make your own version to change the default and install your fork locally. ^.^

Seems like it would be a pretty minimal patchset to keep in sync. Maybe even PR it looking in a config in $XDG_CONFIG_HOME somewhere for what default config options for it to set (don’t forget to log to user that it found a config file at a given location and is using it for defaults so it’s not silently surprising).

Where Next?

Popular in Questions Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
pgiesin
This should be a simple problem but I just can’t seem to figure it out. I have a standalone Elixir app that won’t find the database. Dep...
New
sacepums
Hey guys. I'm new to elixir and im really stocked about it. But I ran into a bit of problem - I need to convert a date sting, for examp...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
hpopp
To simplify some tasks at work, I wrote and published this package yesterday. It’s a simple macro that enables Access behaviour on struct...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New

Other popular topics Top

Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3268 119930 1237
New
yurko
Here are few pieces of (common) Linux knowledge that we use for reasonably small one server apps. We use Ubuntu but this should work for ...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
AstonJ
You’re a programmer, so you don’t need spoon feeding with the conventional drivel about “this is an integer.” No. You need to know what’s...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 35421 110
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
magnetic
Hey :wave:t3: Elixir community, I’ve been learning Elixir, and working on some side projects. My editor of choice is VSCode, and althoug...
New

We're in Beta

About us Mission Statement