Matua Doc

Matua Doc

Creating an SQLite database

Thanks to Luna for writing the initial version of these instructions.

Instructions for GitHub Codespaces/Ubuntu

  1. Open your Swift Playground.
  2. Click the New Terminal button at the bottom of the screen
  3. Update your software repository by typing the following command and pressing Enter: sudo apt update
  4. Install SQLite with this command: sudo apt install sqlite3 libsqlite3-dev
  5. Create the database using this command: sqlite3 Sources/SwiftPlayground/database.db "VACUUM;" (swapping database with a more meaningful name, if applicable)
  6. Open the Extensions sidebar.
  7. Install an extention for opening SQLite databases, such as SQLite 3 Editor by yy0931.

Instructions for Windows 11 (personal device)

If you wish to develop an application that uses SQLite locally on your own Windows 11 device, follow these instructions:

  1. Open the Windows Terminal program.
  2. Install SQLite by copy-pasting the following command into the Terminal and pressing Enter: winget install -e --id SQLite.SQLite
  3. Install DB Browser using this command: winget install -e --id DBBrowserForSQLite.DBBrowserForSQLite
  4. Use DB Browser to create a new database, saving it where-ever your project files are stored.

Instructions for Windows 11 (school devices)

If you wish to develop an application that uses SQLite locally on the school computers, follow these instructions:

  1. Open the Windows Terminal program.
  2. Install Scoop by copy-pasting the following commands (all lines at once). Don’t paste these into the Terminal! Instead, right-click on the Terminal window:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope
CurrentUserInvoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
  1. Install SQLite using this command: scoop install main/sqlite
  2. Install DB Browser using these two commands:
    • scoop bucket add extras
    • scoop install extras/sqlitebrowser

Instructions for macOS

If you wish to develop an application that uses SQLite locally on macOS, follow these instructions:

  1. Open the Terminal app.
  2. If you haven’t already installed Homebrew, copy-paste the following command into the terminal and press Return: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  3. After Homebrew is installed, install SQLite with this command: brew install sqlite
  4. Install DB Browser using this command: brew install --cask db-browser-for-sqlite
  5. Use DB Browser to create a new database, saving it where-ever your project files are stored.