Skip to content

Commit

Permalink
Prepare for release 1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
AlecKazakova committed Jun 22, 2020
1 parent 04891d1 commit dfe02a1
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 119 deletions.
50 changes: 50 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,45 @@
# Change Log

## [1.4.0] - 2020-06-22
### Added
* [MySQL Dialect] MySQL support (by [Jeff Gulbronson][JeffG] & [Veyndan Stuart][VeyndanS])
* [PostgreSQL Dialect] Experimental PostgreSQL support (by [Veyndan Stuat][VeyndanS])
* [HSQL Dialect] Experimental H2 support (by [Marius Volkhart][MariusV])
* [SQLite Dialect] SQLite FTS5 support (by [Ben Asher][BenA] & [James Palawaga][JamesP])
* [SQLite Dialect] Support alter table rename column (#1505 by [Angus Holder][AngusH])
* [IDE] IDE support for migration (.sqm) files
* [IDE] Add SQLDelight Live Templates that mimic built-in SQL Live Templates (#1154 by [Veyndan Stuart][VeyndanS])
* [IDE] Add new SqlDelight file action (#42 by [Roman Zavarnitsyn][RomanZ])
* [Runtime] transactionWithReturn API for transactions that return results
* [Compiler] Syntax for grouping multiple SQL statements together in a .sq file
* [Compiler] Support generating schemas from migration files
* [Gradle Plugin] Add a task for outputting migration files as valid sql

### Changed
* [Documentation] Overhaul of the documentation website (by [Saket Narayan][SaketN])
* [Gradle Plugin] Improve unsupported dialect error message (by [Veyndan Stuart][VeyndanS])
* [IDE] Dynamically change file icon based on dialect (by [Veyndan Stuart][VeyndanS])
* [JDBC Driver] Expose a JdbcDriver constructor off of javax.sql.DataSource (#1614)

### Fixed
* [Compiler]Support Javadoc on tables and fix multiple javadoc in one file (#1224)
* [Compiler] Enable inserting a value for synthesized columns (#1351)
* [Compiler] Fix inconsistency in directory name sanitizing (by [Zac Sweers][ZacS])
* [Compiler] Synthesized columns should retain nullability across joins (#1656)
* [Compiler] Pin the delete statement on the delete keyword (#1643)
* [Compiler] Fix quoting (#1525 by [Angus Holder][AngusH])
* [Compiler] Fix the between operator to properly recurse into expressions (#1279)
* [Compiler] Give better error for missing table/column when creating an index (#1372)
* [Compiler] Enable using the outer querys projection in join constraints (#1346)
* [Native Driver] Make execute use transationPool (by [Ben Asher][BenA])
* [JDBC Driver] Use the jdbc transaction APIs instead of sqlite (#1693)
* [IDE] Fix virtualFile references to always be the original file (#1782)
* [IDE] Use the correct throwable when reporting errors to bugsnag (#1262)
* [Paging Extension] Fix leaky DataSource (#1628)
* [Gradle Plugin] If the output db file already exists when generating a schema, delete it (#1645)
* [Gradle Plugin] Fail migration validation if there are gaps
* [Gradle Plugin] Explicitely use the file index we set (#1644)

## [1.3.0] - 2020-04-03

* New: [Gradle] Dialect property to specify with sql dialect to compile against.
Expand Down Expand Up @@ -245,3 +285,13 @@
## [0.1.0] - 2016-02-12

Initial release.

[JeffG]: https://github.com/JGulbronson
[VeyndanS]: https://github.com/veyndan
[BenA]: https://github.com/benasher44
[JamesP]: https://github.com/jpalawaga
[MariusV]: https://github.com/MariusVolkhart
[SaketN]: https://github.com/saket
[RomanZ]: https://github.com/romtsn
[ZacS]: https://github.com/ZacSweers
[AngusH]: https://github.com/angusholder
117 changes: 1 addition & 116 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,123 +1,8 @@
# SQLDelight

See the [project website](https://cashapp.github.io/sqldelight/) for documentation and APIs.

SQLDelight generates typesafe APIs from your SQL statements. It compile-time verifies your schema, statements, and migrations and provides IDE features like autocomplete and refactoring which make writing and maintaining SQL simple. SQLDelight currently supports the SQLite dialect and there are supported SQLite drivers on Android, JVM, iOS, and Windows.

## Example

To use SQLDelight, apply the [gradle plugin](https://github.com/square/sqldelight#gradle) and put your SQL statements in a `.sq` file in `src/main/sqldelight`. Typically the first statement in the SQL file creates a table.

```sql
-- src/main/sqldelight/com/example/sqldelight/hockey/data/Player.sq

CREATE TABLE hockeyPlayer (
player_number INTEGER NOT NULL,
full_name TEXT NOT NULL
);

CREATE INDEX hockeyPlayer_full_name ON hockeyPlayer(full_name);

INSERT INTO hockeyPlayer (player_number, full_name)
VALUES (15, 'Ryan Getzlaf');
```

From this SQLDelight will generate a `Database` Kotlin class with an associated `Schema` object that can be used to create your database and run your statements on it. Doing this also requires a driver, which SQLDelight provides implementations of:

#### Android
```groovy
dependencies {
implementation "com.squareup.sqldelight:android-driver:1.3.0"
}
```
```kotlin
val driver: SqlDriver = AndroidSqliteDriver(Database.Schema, context, "test.db")
```

#### iOS, or Windows (Using Kotlin/Native)
```groovy
dependencies {
implementation "com.squareup.sqldelight:native-driver:1.3.0"
}
```
```kotlin
val driver: SqlDriver = NativeSqliteDriver(Database.Schema, "test.db")
```

#### JVM
```groovy
dependencies {
implementation "com.squareup.sqldelight:sqlite-driver:1.3.0"
}
```
```kotlin
val driver: SqlDriver = JdbcSqliteDriver(JdbcSqliteDriver.IN_MEMORY)
Database.Schema.create(driver)
```

#### Javascript
```groovy
dependencies {
implementation "com.squareup.sqldelight:sqljs-driver:1.3.0"
}
```
```kotlin
initSqlDriver(Database.Schema).then { db ->
//...
}
```

SQL statements inside a `.sq` file can be labeled to have a typesafe function generated for them available at runtime.

```sql
selectAll:
SELECT *
FROM hockeyPlayer;

insert:
INSERT INTO hockeyPlayer(player_number, full_name)
VALUES (?, ?);

insertFullPlayerObject:
INSERT INTO hockeyPlayer(player_number, full_name)
VALUES ?;
```

Files with labeled statements in them will have a queries file generated from them that matches the `.sq` file name - putting the above sql into `Player.sq` generates `PlayerQueries.kt`. To get a reference to `PlayerQueries` you need to wrap the driver we made above:

```kotlin
// In reality the database and driver above should be created a single time
// and passed around using your favourite dependency injection/service locator/singleton pattern.
val database = Database(driver)

val playerQueries: PlayerQueries = database.playerQueries

println(playerQueries.selectAll().executeAsList())
// Prints [HockeyPlayer(15, "Ryan Getzlaf")]

playerQueries.insert(player_number = 10, full_name = "Corey Perry")
println(playerQueries.selectAll().executeAsList())
// Prints [HockeyPlayer(15, "Ryan Getzlaf"), HockeyPlayer(10, "Corey Perry")]

val player = HockeyPlayer(10, "Ronald McDonald")
playerQueries.insertFullPlayerObject(player)
```

# Gradle

```groovy
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.squareup.sqldelight:gradle-plugin:1.3.0'
}
}
apply plugin: 'com.squareup.sqldelight'
```
See the [project website](https://cashapp.github.io/sqldelight/) for documentation and APIs

License
=======
Expand Down
2 changes: 1 addition & 1 deletion docs/common/rxjava.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ To observe a query, depend on the RxJava extensions artifact and use the extensi

```groovy
dependencies {
implementation "com.squareup.sqldelight:rxjava3-extensions:1.3.0"
implementation "com.squareup.sqldelight:rxjava3-extensions:{{ versions.sqldelight }}"
}
```

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
GROUP=com.squareup.sqldelight
VERSION_NAME=1.4.0-SNAPSHOT
VERSION_NAME=1.4.0

POM_URL=https://github.com/square/sqldelight/
POM_SCM_URL=https://github.com/square/sqldelight/
Expand Down
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,4 @@ plugins:

extra:
versions:
sqldelight: '1.3.0'
sqldelight: '1.4.0'

0 comments on commit dfe02a1

Please sign in to comment.