Fork me on GitHub

Hello, i don't really understand with the concept of 'migration'. As far as i know, i have to put query to create table in up file and drop table in down file. But how about the data? do i have to backup and create script to re-insert all data when i have new version of the schema? I'm using migratus atm.

Evan Bowling04:12:31

Personally I wouldn’t script the creation of data rows unless they were minimal and had a very specific set of required values. While schema migrations support incremental development, they don’t fully replace standard db backup/restore processes Here’s a link that may help:

❤️ 3

At work, we're up to about 860 migrations now, from an empty database to the current production setup. When you change the schema, you have two choices: 1) make changes in a strictly backward-compatible manner (e.g., adding nullable columns, adding columns with defaults) or 2) use specific scripted manually-applied schema/data migrations to do more complex things.

❤️ 3

Sometimes, your tables are too large in production to be able to just run automated migrations that modify the schema. Sometimes you have to get very creative, creating new versions of tables, swapping them atomically in production, and then backfilling the new table from the old -- and dealing with any weirdness that may cause your applications. Sometimes you can't even do that and, instead, you need to create a new table and also update your code to conditional work on the new table or the old table while it migrates data on demand and then backfills.

❤️ 3

All that said, in practice for most migrations, you are creating new tables or you're working with small enough databases that most schema operations are "safe" 🙂

❤️ 3

Okay, thank you everyone! now i understand better!


I have seen this used within cljs hiccup code a few times, not sure what it means [:<> ...


Hello, I got a Clojure Java interop question and hope this is the right place. Given the class

public class VXI11Factory {
     * Create a VXI11Controller.
     * @param hostName The hostName or INET address.
     * @param vxiName The VXI name.
     * @return The interface for the VXI11Controller.
    public static VXI11Controller create(String hostName,String vxiName){
        Controller controller = new Controller(hostName,vxiName);
        return controller;
I want to create a VXI controller by (.create (VXI11Factory.) "host" "dev") but receive No matching method create found taking 2 args for class jvxi11.VXI11Factory The (:import [jvxi11 VXI11Factory VXI11UserFactory VXI11Controller])) seems to work and I got no idea where to start. Can someone point to a search direction, thank you!

Timur Latypoff09:12:46

You're trying to access a static method as a member. Try this instead: (VXI11Factory/create "host" "dev")

💯 3
Timur Latypoff09:12:58

The static method does not belong to any instance, so you just run it directly with this syntax (ClassName/staticMethod ...)


Great! Thank you very much!

👍 3

Forgot a link: I try to access this lib:

Abraham Palmer14:12:24

I mostly run these days, but started learning Clojure last week to work on some hobby projects. As a hobbyist I really appreciate a broad scope of a few tools so that building my application doesn't require me to put a dozen new things on my stack and holds up well over time. My current bakery application running some Python on Google's AppEngine has really only been updated once in 10 years so I don't want to spend a lot of time upgrading just to upgrade. I'm interested in building peer-to-peer applications on the cryptographically secure distributed database/platform I'll need some Clojure for utilities and maybe even a desktop app and maybe a few small services and then ClojureScript for some SPA's. I might also need a local database to pull together for efficient searching multiple datasets in Holochain. Let me know if you are on a similar path or have suggestions for the journey.

Sam Stowers17:12:28

Have you seen Clojure Biff? It's new but could help you take care of several of the above in one swoop

Abraham Palmer11:12:31

Yes, I actually just saw a talk on that at re:Clojure and the author said "yes, you could use a different database. there would be significant work involved, particularly with implementing query subscriptions. But a while ago someone was experimenting with using datomic instead of crux, and I've structured the code to facilitate swapping out the db". Definitely worth digging into.


Hi, When I call (keyword "name") I get :name. How do I get ::name for a string "name"?


::name doesn't exist


::name is syntax, that when read depending on the context can be come any number of values


there is single value that is ::name that prints as ::name


Right, ::name is name keyword on current namespace, correct?


evaluate ::name in a repl


this is going to go places

😂 3



"current namespace" is the binding of the dynamic var *ns*


that only has a meaningful value when code is being read and compiled


generally while code is executing *ns* can be anything entirely unreleated to whatever code is executing


clojure spec asks me to create specs as ::name, which means my maps need keys ::name, while :name fails

Alex Miller (Clojure team)21:12:22

clojure spec does not ask you to do that, you can use any keyword you like


the spec docs use :: for brevity, not because you have to


ok, thanks!


some disagree, but I recommend avoiding using :: at all, because it makes things very context dependent


*any namespace qualified keyword :foo/bar OR ::bar BUT NOT :bar (not qualified)


for the current namespace thing, which is maybe moot now, but something to know and keep in mind is that a clojure namespace is not like a class, there is no "this" pointer or whatever. a function is a value that could be named in multiple namespaces, and it doesn't have a pointer to the whatever the current namespace was when it was compiled

Alex Miller (Clojure team)21:12:35

there is a block in the spec guide that talks about this. I pushed a change to make that a bit more prominent

❤️ 6

The non-compile time namespace binding I knew about. But it makes sense. Thanks!