Commit Graph

64 Commits

Author SHA1 Message Date
Pascal Hertleif
0e7c2e1fe0 Merge origin/sg-doc-types into rollup-some-prs
PR #407
2016-09-13 11:55:47 +02:00
Pascal Hertleif
ed3c350caa Travis, we don't fail on beta!
Also, cache some things. This will become more useful when cargo a
workspace is used so there is one central `target/` directory.
2016-09-09 16:58:36 +02:00
Sean Griffin
1e788ad171 Ensure that our examples continue to compile as part of our tests
Travis of course isn't following the guide, so it won't have set
`DATABASE_URL` to what I want nor will it have run `diesel setup`
2016-09-09 16:26:01 +02:00
Sean Griffin
0e9acca6de Bump nightly version
It's been 6 weeks! We're still 100% compatible with no code changes
(other than the compile test)
2016-08-18 19:21:38 -04:00
Sean Griffin
306ad26711 Better document the types module
I've seen a lot of people making the mistake of trying to put things
like `diesel::types::Timestamp` in their structs. This attempts to
better document the role of the `types` module, and documents any
`ToSql` and `FromSql` impls that are provided. I've un-inlined the pg
types module, as stating "this is a postgres specific type" in the
documentation over and over again didn't feel right. I've also made sure
that the UUID feature is turned on when generating docs.
2016-08-17 10:24:42 -04:00
Sean Griffin
36b8801bf5 Split diesel_codegen into two crates.
Having the same crate for both has caused a ton of problems with
linking. I had hoped to just use cargo features for this, but it wasn't
working out that way.

`diesel_codegen` now only targets nightly. `diesel_codegen_syntex`
handles syntex separately (and also contains the common code between the
two crates). Neither crate includes the postgres feature by default.

How to migrate
--------------

If your Cargo.toml previously looked like this:

```rust
[build-dependencies]
diesel_codegen = "0.6.0"
```

it should change to

```rust
[build-dependencies]
diesel_codegen_syntex = { version = "0.7.0", features = ["postgres"] }
```

(You'll need to change the `extern crate` line in `build.rs`)

If your Cargo.toml previously looked like this:

```rust
[dependencies]
diesel_codegen = { version = "0.6.0", default-features = false, features = ["nightly", "postgres"] }
```

it should change to

```rust
[dependencies]
diesel_codegen = { version = "0.7.0", features = ["postgres"] }
```

I've had to split out the cargo features in our test suite, since Cargo
doesn't give me a way to say "turn on the
diesel_codegen_syntex/postgres" feature only if the `with-syntex`
and `postgres` features are on, and I don't want to have to build syntex
every time I run the tests against nightly.
2016-08-01 13:43:10 -04:00
Sean Griffin
4267ca4243 Update our codebase for nightly-2016-07-07
Had to delete the test for the owned value to insert. Message involving
the types is now a note not part of the error. Unsure if this is because
it *actually* changed to a note, or if it's a quirk in compile_tests
0.2.0 (if I test for the note I need to specify *all* notes and the note
on the overflow error is enought o make me not want to do that
2016-07-18 09:51:04 -04:00
Sean Griffin
747aa09036 Bump nightly version 2016-05-11 22:49:43 -04:00
Tim Brooks
13123d620d Follow convention for new AST pointers
Old empty() method removed in
9108fb7bae
2016-04-29 16:24:26 +02:00
Sean Griffin
1af8d560c1 Fix travis build (again)
Even though my `rustc --version` says it's 2016-04-07, it appears the
error changes that we're testing against occurred on the 8th
2016-04-12 12:20:21 -06:00
Sean Griffin
848d191515 Bump to the latest nightly
We were affected by breaking changes with how struct fields are
represented. Now that I can get the tests compiling, I noticed that I
implemented the `Option` impl for specialization incorrectly.
2016-04-08 15:31:10 -04:00
Sean Griffin
66c8df00b0 Bump nightly version 2016-04-02 18:12:51 -06:00
Sean Griffin
6f975d1d19 Enable the chrono feature for documentation
The `FromSql` impls aren't getting documented as is.
2016-04-02 16:07:24 -06:00
Sean Griffin
2877027814 Add a CNAME to the docs so we can use the custom domain 2016-03-31 14:14:37 -06:00
Sean Griffin
03ba21a7c7 Bump nightly version
03-11 had a bug that occurred when we pulled out new functions or
modules sometimes. We still don't compile on the latest nightly.
2016-03-28 15:38:05 -06:00
Sean Griffin
7302674d3f Update the local test script to handle #226 2016-03-27 17:09:32 -06:00
Sean Griffin
306323ba78 Merge pull request #226 from weiznich/sqlite_infer_schema
Implement infer_schema for sqlite
2016-03-27 16:21:01 -06:00
Sean Griffin
2df569807f Fix code style issues for #226 2016-03-27 16:20:07 -06:00
Georg Semmler
1172358a7e Update .travis.yaml
* Set the correct database url for sqlite
* Use Backend config for codegen tests
2016-03-14 23:42:01 +01:00
Matt Casper
203ffb981a Go back to printing errors and then exiting 1
This was removed earlier because if a diesel_cli test started failing,
it would abort the entire test suite because it exited with a status
code of 1, which rust interprets as a problem. Now, because we shell out
all our tests that ever hit this part of the code, we can go back to
printing errors and exiting 1. This presentation is much nicer than a
panic.
2016-03-14 15:33:46 -07:00
Sean Griffin
9084bb62d7 Fix travis build
2016-03-10 isn't a nightly that exists.
2016-03-12 16:12:03 -07:00
Sean Griffin
bb29ac4aca Update to latest nightly
`time2` has been stabilized (with some API changes, which we need to
match). We still need it behind the `unstable` feature for another 6
weeks until it's stabilized. Unfortunately, quickcheck has been
unresponsive on updating to address this. I've simply commented out that
test for the time being.
2016-03-12 15:38:10 -07:00
Barosl Lee
449519f7df Adapt to nightly changes introduced by rust-lang/rust#31487
Fixes #218.
2016-02-17 11:12:40 +09:00
Matt Casper
208a5d8adc Move all database related functions into their own module 2016-02-04 09:49:39 -08:00
Matt Casper
d7788aad02 Implement Sqlite support for the CLI.
Because `Connection` isn't object safe (and probably shouldn't be),
switching based on the desired backend had to be achieved through
branching, handled with a macro wherever possible. This will obviously
grow more and more burdensome as more backends are added, and a better
solution will have to be figured out in the future.

I also split out database related functions into their own module, as it
was starting to feel like too much to juggle in one file.

The tests in the `database` mod each use their own database, as for many
of them we're dropping and creating the database, which can't be wrapped
in a transaction. Using a separate database for each allows us to still
run the tests multi threaded, but does add the extra cost of some setup
and teardown in the code.

The Sqlite portions don't use the `temdir` crate for generating their
database path because I couldn't figure out an ergonomic way of keeping
the tests able to run for both backends, while keeping the TempDir in
scope (returning a path from a function causes the TempDir to go out of
scope, which removes the directory in its destructor).
2016-02-04 08:20:39 -08:00
Sean Griffin
e1f618eb7c Move compile-fail to a separate suite
I want to write some tests confirming that PG expressions don't compile
on SQLite. These are only meaningful when tested against Diesel with
both SQLite *and* PG enabled, which we explictly don't want to do in the
main test suite.
2016-02-03 07:45:58 -07:00
Sean Griffin
9da6065fb5 Ensure that we are *actually* able to compile without PG
While the tests were passing previously, we didn't actually build if you
compiled without libpq installed on your system. This corrects those
issues, and the failures that resulted from it. There are several places
where I'm legitimately unsure how the code compiled before this change.

I've had to do some janky things to codegen to make it actually work, as
there's an issue where cfg attrs aren't properly applied inside of
`include!`. This is why the dummy version has to exist, and why it warns
instead of errors. It might make sense to just define the macro as a
no-op in the future.
2016-02-03 06:58:25 -07:00
Sean Griffin
d9f733f856 Remove hard dependencies on libpq and libsqlite3
All code which *directly* depends on these has been moved to a separate
module and placed behind a cfg attr. There is still a ton of PG specific
stuff hidden in the expressions module that simply isn't marked as such.

I had to rework how we do our boilerplate type impls, as `sqlite` and
`postgres` need to be able to co-exist in the same compile pass (even
just for generating docs).

While this PR is pretty large, it ultimately mostly comes down to
clerical work.

Fixes #159.
2016-02-03 06:58:25 -07:00
Sean Griffin
b136f2c4b0 Make sure Travis uses an up to date version of sqlite
I have no clue why this changes based on the value of `sudo: required`.
Without it, Travis uses 3.7. With it, Travis uses 3.8.

Fixes #167
2016-02-03 06:58:25 -07:00
Sean Griffin
17f4b8d487 Setup travis in a way that doesn't use ancient SQLite versions
The version that is in the container infrastructure is from 2011. We use
`sqlite3_errstr` which was added in 2012. The switch to the "trusty"
infratstructure bumps it to 3.8, which is relatively recent.

This exposes a legitimate bug related to nul bytes in string fields that
for some reason not replicating for me locally.
2016-02-03 06:58:24 -07:00
Sean Griffin
17a3034bcd Initial SQLite support
This commit adds all of the guts for SQLite3 support to Diesel. There
are several outstanding issues which will need to be resolved before
this is ready to be merged into master. This commit will not be merged
into master until these issues have been resolved.

Ultimately the most difficult remaining problem which we need to address
is the lack of a `DEFAULT` keyword. I will detail why this is a problem
and what I think we can do to solve it in a separate issue.

SQLite has a fundamentally different mechanism for handling bind
parameters than pretty much every other backend out there, where the
function you call differs based on the type, rather than sending an
array of bytes and telling the backend how to interpret it. `FromSql`
had to be updated to address this (see
8a33029944
for details on that). I have not applied the same change to `ToSql`, as
it was possible to shoehorn SQLite into our existing structure. While
this may end up changing in the future, I do not believe it is necessary
for 0.5.

I'm not super happy about the structure of `StatementIterator`,
`SqliteRow`, and `SqliteValue`, as ultimately the `Row` is a giant lie
and `Statement` is the the value that maintains all of the state.
Ultimately this comes out of the weird interaction between the fact that
`Row#take` returns a reference, but sqlite's C api doesn't actually
return a single value that works in that sense (and really doesn't have
the concept of a row at all). As with much of our code overall, this can
probably be cleaned up in the future by having the `Backend::RawValue`
directly be a reference for `Pg`. I need to figure out a way to
accomplish this without adding a lifetime to the `Pg` struct.

I've broken our test suite into postgres specific and general where
possible, but this is a *very* incomplete process. There are several
modules which are entirely scoped to PG that do not need to be, which
can be addressed independently in later PRs. Additionally, the entire
`expression` module needs to be for expressions which are specific to
PG. I do not believe that SQLite has anything specific to it which is
not also supported by PG.

Fixes #39 (mostly. Enough to close the issue at least)
2016-02-03 06:58:24 -07:00
Sean Griffin
eaffa53d1a Run diesel_cli tests on Travis 2016-02-02 15:15:07 -07:00
Mike Piccolo
5271d8b70b Fix compile fail tests 2016-01-24 19:13:52 -08:00
Sean Griffin
106bcc5a97 Run codegen's tests on CI
These tests were broken by https://github.com/sgrif/diesel/pull/103, but
the tests aren't run on Travis currently
2016-01-18 10:37:43 -07:00
Sean Griffin
07a7e3f877 Update the travis webhook URL (the other doesn't appear to be working)
It's possible the blank line was the problem as well
2016-01-18 10:35:36 -07:00
Sean Griffin
81e5b891d8 Add Travis notifications to the contributors gitter room 2016-01-18 10:22:16 -07:00
Mike Piccolo
53e8c8b494 Bump syntax, quasi and aster. 2016-01-16 20:10:46 -08:00
Sean Griffin
f867947093 Correctly pass cargo arguments on travis
When in doubt, MOAR DASHES
2016-01-15 11:43:25 -07:00
Sean Griffin
6d424d11a4 Improve our test coverage for our time types
The first attempt at adding support for `chrono::NaiveDate` was
completely incorrect. This was in part due to the fact that I never
tested for some known values. Combined with the fact that I've
discovered quickcheck is testing a much smaller set of values than I
thought (which would likely expose some bugs), I wanted to make sure
that our existing tests for real values are at least valid.

The quickcheck tests need to eventually be updated, as `PgDate` will not
in fact round trip for values below -200000ish (earlier than Julian
era), it will silently insert null.
2016-01-15 11:37:47 -07:00
Matt Casper
7a49609986 Remove DATABASE_URL_FOR_SCHEMA from .travis.yml
This env var doesn't seem to be used in tests anymore, so we shouldn't
need it in travis.
2016-01-10 23:10:23 -08:00
Sean Griffin
d75f9483fb Upload docs when stable passes, not nightly
The latest nightly is currently failing due to the `rand` crate, and
there's really not much I can do about it at the moment. Since `nightly`
is an allowed failure, we'll ship when stable passes instead.
2016-01-08 14:55:15 -07:00
Sean Griffin
3d49369176 It's 2016.
This took me embarassingly long to figure out.
2016-01-07 12:57:42 -07:00
Sean Griffin
06d878e908 Bump known working nightly version
There were upstream changes in rustc, which have been resolved in aster,
quasi, etc, but the versions that will resolve as it is no longer build
on 2015-12-30
2016-01-07 06:57:29 -07:00
Mike Piccolo
48c19ee2e7 Use most recent nightly build 2015-12-31 12:47:33 -08:00
Sean Griffin
7a42d4d91f Fix build on nightly
Close #67
2015-12-25 11:53:07 -07:00
Matt Casper
fe9067387f Update nightly build (that can't fail) to today 2015-12-08 20:05:18 -08:00
Sean Griffin
a4a7bc2df6 travis-cargo doesn't pass --features unstable on nightly-date for us 2015-12-06 07:59:31 -06:00
Sean Griffin
6e3c551c40 That's not how shell works 2015-12-06 07:55:41 -06:00
Sean Griffin
63013a17e1 Test nightly build on nightly-date versions 2015-12-06 07:51:16 -06:00
Sean Griffin
c3b157e321 Add last known supported nightly to the matrix 2015-12-06 07:45:43 -06:00