And how to only create a table if it doesn’t already exist: as with sqlite, use ifNotExists
:
db.create(table: "todo", ifNotExists: true) { t in
t.autoIncrementedPrimaryKey("id")
t.column("name", .text).notNull()
}
And how to only create a table if it doesn’t already exist: as with sqlite, use ifNotExists
:
db.create(table: "todo", ifNotExists: true) { t in
t.autoIncrementedPrimaryKey("id")
t.column("name", .text).notNull()
}
With the example of GRDB, a lightweight sqlite wrapper:
class DbManager {
static let sharedInstance = DbManager()
var dbPath: String! <--- !!!
var dbQueue: DatabaseQueue!
private init() {
do {
dbQueue = try connectToDatabase()
try createTable()
} catch {
print(error)
}
}
}
Continue reading Right here: add through pasting a github URL. All done.
I love it when there’s an official way of managing packages. The evolution of even package management systems are just too much.
And how to uninstall: from the +/- button here. Not as friendly. Why couldn’t they have added a “remove package” option on the leftnav?
This happens after moving the swift files around.
Solution: simply quit Xcode and reload so that it can re-source the new location of the files.
Or command + B to rebuild. Sometimes those formatting errors are just not caught up and not rebuilt yet.
Every once in a while I end up moving to a new setup, and have to do this all over again. Here for my own reference:
First, the color scheme I like:
Continue readinghttps://github.com/junegunn/fzf#using-homebrew
Worth installing everywhere. On OSX, simply:
$ brew install fzf
# To install useful key bindings and fuzzy completion:
$(brew --prefix)/opt/fzf/install
What worked for me was updating the “Refresh Rate” from 30HZ to 60HZ:
Continue readingTo sort folders by their size, recursively:
$ du -h | sort -h
Then, to delete any folder of the name to_delete
:
$ rm -rf `find . -type d -name to_delete`
This is not a happy situation to begin with, but what if you have to? Someone has to do the dirty job. In order for you to not have your laptop connected to the production environment for 10 hours just to run a job, you need:
Continue readingTwo steps [1]:
thisisunsafe
Funny that Google doesn’t provide a button anywhere on the page for this. Guess you’ll only be able to find a solution if you know how to “Google”.